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

Data Environment Setting Parameter Help 1

Status
Not open for further replies.

maxflitom

Programmer
Aug 26, 2002
70
US
Is is possible to either set parameters of a child command or set the .CommandText of a child command. I am attempting to generate a DataReport using Access 2000. I wish to list my employees (from the Employees table) and have their Gratuties (Gratuty table) listed (grouped) under them sorted by the EventDate field in the Events table.

I want to set the the .CommandText for the child command to something like this:

SELECT fields) FROM Gratuities INNER JOIN Events ON Events.EventID=Gratuties.EventID WHERE Events.EventDate BETWEEN ? AND ?

The results should look like this.

First Employee Name
Event One 02/06/04 5.00
Event Two 02/06/04 10.00

Second Employee Name
Event One 02/06/04 5.00
Event Two 02/06/04 10.00

Any suggestions?

Tom (maxflitom)
 
In your DataEnvirnment, try

PARAMETERS pDateFrom DATETIME, pDateTo DATETIME;
SELECT fields) FROM Gratuities INNER JOIN Events ON Events.EventID=Gratuties.EventID WHERE Events.EventDate BETWEEN pDateFrom AND pDateTo
 
zyrag's should work, but you can just do this:

myDE.MyConnection.MyParentCommand.MyChildCommand.CommandText = "SELECT fields) FROM Gratuities INNER JOIN Events ON Events.EventID=Gratuties.EventID WHERE Events.EventDate BETWEEN (" & Variable1 & " AND " & Variable2 & ")"

Where variable1 and variable2 are the dates, say gotten from text boxes or whatever.

HTH

Bob Rodes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top