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

Passing date criteria from text boxes on form into query

Status
Not open for further replies.

glgcag

MIS
Apr 25, 2001
160
0
0
US
I can't seem to get dates that I have entered into two fields on a form into the BETWEEN . . .AND criteria in my query. I'm probably missing something simple, but I keep going around in circles. Here's my query:

SELECT tAGProjects.AGProjectKey AS [Project#], _
tAGProjects.ProjectTitle AS [Project Title], _
tAgents.AgentKey,tProjectArticleLog.DateSent AS _
[Date Sent]
FROM (tAgents INNER JOIN ((tAGProjects INNER JOIN _
tProjectArticleLog ON tAGProjects.AGProjectKey = _
tProjectArticleLog.AGProjectKey) INNER JOIN _
tProjectAgents ON tAGProjects.AGProjectKey = _
tProjectAgents.AGProjectKey) ON tAgents.AgentKey = _
tProjectAgents.AgentKey)
WHERE (((tAgents.AgentKey)=[Forms]![fAG_Articles]![cmbAgent].[Value]) AND ((tProjectArticleLog.DateSent) _
Between ([Forms]![fAG_Articles]![txtStartDate].[Text]) _
And ([Forms]![fAG_Articles]![txtEndDate].[Text])))

ORDER BY tProjectArticleLog.DateSent DESC;

I have code that runs this query when a command button is pressed on the form.

I appreciate the help!

GLGCAG

 
What is [Text] try
Between ([Forms]![fAG_Articles]![txtStartDate]) _
And ([Forms]![fAG_Articles]![txtEndDate])))if you are trying to define the field as text then you have to define the parameters, which should be Date/Time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top