Solved

taking dates from form and placing into query not working

Posted on 2014-09-16
4
120 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 34

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now