Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox assign global variables

Status
Not open for further replies.

kfoley

Programmer
Jul 23, 2002
4
US
I want to be able to assign the value of global variable to an unbound text box. This will contain information regarding the report. For instance, the user enters a start and end date into input boxes, these dates are used to pull the data. I want to also put those dates on the report header.

Any ideas?

Kim
 
I do this type of thing alot. I create global variables for parameters storage. I also create Functions to be able to access them both in the query criteria and reporting display.

Create Global Variables and Function in database Module:
Global vStartDate as Date
Global vEndDate as Date
Function StartDate()
StartDate = vStartDate
End Function
Function EndDate()
EndDate = vEndDate
End Function

Make you assignments to the Global variable based on Input:
vStartDate = InputBox("Enter Start Date:")
vEndDate = InputBox("Enter End Date:")

In a query you can use the Function calls to select the records:
Select * from tblYourTableName WHERE tblYourTableName.InvoiceDate >= StartDate() and tblYourTableName.InvoiceDate <= EndDate();

In the report controls you can set the Control Source to:

=StartDate()
and
=EndDate()


Let me know if this works for you.








Bob Scriver
 
I have the module set up similar to yours. I don't understand how to get the global values onto the actual report. I get the data, I now need the dates to be in the report header.

Example

Joe Sales(label) startdate through enddate (as label or textbox)

Hope this makes sense.

Kim
 
Create two controls. In the Properties of the controls set the Control Source to =StartDate() and =EndDate() respectively. Also, set the format for the controls to how you want them to look on the report.

Clearer?? Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top