Macro: How to Transfer Data from Form to Report

Penis pumps: Another safe and effective way of adding inches to penis helps battle problems like erectile dysfunction and try to avoid buy cialis it as much as possible. We are fortunate to Recommended web-site cheap viagra have the same brand in generic at the reduced cost. The natural herbs found in VigRx target the improvement of potency during sexual disorder. viagra cialis levitra purchase viagra online However, you must know that the Internet makes it possible for every buyer of Kamagra.


Macro: Transfer Text from Form to Report

(VB: Transfer Text from Form to Report)

In this How To, I will show you how to transfer data from textbox on form to report. Data on the textbox is not stored in the table. For example below, I have two textboxes on the form for start and end date. I want to open a report by the date range from the start date and end date that I enter on the form. I also want the date range to show on the report as well.

Step 1 Add two textboxes on form (Main Menu form)

  • Add the first unbound textbox and name it “txtStartDate” for a start date.
  • Add the second unbound textbox and name it “txtEndDate” for the end date.

add two text box

Step 2 Add macro code to open report

Under the design view mode, click on an Account Detail button and select “Embedded Macro” under the On Click event.

macro open report

Macro Code:

Macro Code How it works:
  1. Check if both the Start Data and End Date are entered
  2. Display a message if the Start Date or End Date is not entered
  3. If both dates are entered then set both dates to a temp variable (tempStartDate & tempEndDate)
  4. Open report with a record criteria from Start Date to End Date
  5. If there is an error then show an error message and resume next step

macro code 1macro code 2

Step 3  Add two textboxes on report

  • Add the first unbound textbox for a start date.
  • Add the second unbound textbox for the end date.

two text on report

Step 4  Link Start Date textbox on report

  • Double Click on the From Date textbox (or Start date)
  • Click on a Data tab of Property Sheet
  • Update Control Source = “=[TempVars]![tempStartDate]”

macro start date

Step 5  Add link End Date textbox on report

  • Double Click on the To Date textbox (or End date)
  • Click on a Data tab of Property Sheet
  • Update Control Source = “=[TempVars]![tempEndDate]”

macro end date

Step 6 Complete and Testing

  • Entering two dates on the Start Date and End Date boxes
  • Click on Account Detail button

date on form

As Result: the Start Date and End Date on form will show on the report of From Date and To Date as shown below.

report

Related posts