Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

taking dates from form and placing into query not working

Posted on 2014-09-16
4
127 Views
Last Modified: 2014-09-17
I have a form that has 2 text boxes for "start date" and "EndDate".
using the BETWEEN operator in the field "QueryDate"...


SELECT dbo_iData_Desc_Search_Log.RACF, dbo_emp_directory_04172014.emp_name, dbo_emp_directory_04172014.mgr1_name, dbo_iData_Desc_Search_Log.QueryDate, dbo_iData_Desc_Search_Log.ProcRun, dbo_iData_Desc_Search_Log.SearchTerm, dbo_iData_Desc_Search_Log.iDataVersion
FROM dbo_iData_Desc_Search_Log INNER JOIN dbo_emp_directory_04172014 ON dbo_iData_Desc_Search_Log.RACF = dbo_emp_directory_04172014.emp_racfid
WHERE (((dbo_iData_Desc_Search_Log.RACF)=[Forms]![iData_Reporting]![Combo5]) AND ((dbo_emp_directory_04172014.mgr1_name)=[Forms]![iData_Reporting]![Combo3]) AND ((dbo_iData_Desc_Search_Log.QueryDate) Between [forms]![iData_Reporting]![Text37] And [forms]![iData_Reporting]![Text39]))
ORDER BY dbo_iData_Desc_Search_Log.QueryDate;

Need correct syntax


Thanks
fordraiders

Open in new window

0
Comment
Question by:fordraiders
  • 2
4 Comments
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40325659
Are you getting an error message?  What is it?
Are the textboxes defined as date data types?
Does QueryDate include time?

PS - before you write any code or reference any controls on a form, best practice is to give them meaningful names so Text37 should be something like txtFromDT and Text39 should be something like txtThroughDT.  Combo5 should be cboRACF and Combo3 should be cbomgr1_name
0
 
LVL 3

Author Comment

by:fordraiders
ID: 40325679
Between DateValue([forms]![iData_Reporting]![Text37]) And DateValue([forms]![iData_Reporting]![Text39])....this worked.

Thanks included  datetime...that helped.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40327437
DateValue is perfect here.

And Pat is right. Get rid of Text39 etc. at the very soonest as the first thing you do.

/gustav
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 40327990
Thanks for the direction
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question