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!

Access 07 - Query based on dates from a form

Status
Not open for further replies.

PavelowFE

Technical User
Jan 13, 2009
39
US
I'm trying to get a query of a table output the data based on the start and end dates of a form (that remains open).

Here's what I have, but it isn't working. I've tried several ways using the WHERE function.

As always, I appreciate the help very much.

SELECT DISTINCTROW Sum([Teams Trained].[Team Members]) AS [# of Operators Trained]
FROM [Teams Trained]
WHERE Between [Forms]![Date Range]![Start Date] And [Forms]![Date Range]![End Date];


Vince
 
Code:
SELECT DISTINCTROW Sum([Teams Trained].[Team Members]) AS [# of Operators Trained]
FROM [Teams Trained]
WHERE [COLOR=red][i]Datefield [/i][/color]Between [Forms]![Date Range]![Start Date] And [Forms]![Date Range]![End Date];
 
Does the word "Datefield" go there? If so, all I get is a popup window for Datefield.

 
I got it now. I used

[Start Date] And [End Date] for Datefield.

Thanks!

Vince
 
did you test the query to see that it returns the rows that you want
 
Yes, it checked good.

Now, for part II:

I want to have the Date Range as a subform on my main form. How can I get all the functions relying on [Forms]![Date Range] to work?

Thanks again for the help.
 
Got it.

Have to call up the main form, then the subform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top