Solved

taking dates from form and placing into query not working

Posted on 2014-09-16
4
124 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 35

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

773 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