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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Feeding Date to a report... 1

Status
Not open for further replies.

bluenoser337

Programmer
Jan 31, 2002
343
CA
I'm calling an Access 2000 report from VB6 with .DoCom.OpenReport...and I want to pass the date (or dates) of the production being reported so I can have it printed on the report. Note: Not the date of the printing, but the date(s) the report covers. What's the best way to do this?
 
bluenoser337
Create an unbound form with two fields. Let's call them txtStartDate and txtEndDate.

Then in your production date column in the query that populates the report, put the following criteria...

Between Forms!YourFormName!txtStartDate And Forms!YourFormName!txtEndDate

Then on the report header, put a text box with something such as...
="This report covers the time period between " & Forms!YourFormName!txtStartDate And Forms!YourFormName!txtEndDate

Tom
 
Thanks...but I really need to use the date(s) from the WhereCondition in VB. Am I missing something? The query in Access gets info from all dates.
 
how are you setting the Where condition? If you can use a Parameter Query as the RecordSource of the Report, you can capture the Parameters and use them in a textbox.

For example you have a query the uses
Between [Enter Beginning Date] And [Enter End Date]
as the criteria for a date field you can use this as the controlsource for a textbox that is in the Report Header or Page Header...

= "This Report Is Based On Dates Between " & [Enter Beginning Date] & " And " [Enter End Date]


PaulF
 
Bear with me...I'm sorta new at this. The .DoCom.OpenReport...WhereCondition:=" DateOnly between '" & startdate & "' and '" & enddate & "' "). DateOnly is the DB field. Startdate and enddate are variables in VB (not VBA) derived from Monthview calendars. Will the report recognize variables from the VB application? I'll give it a try. Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top