By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Query Search by date - SQL

P: 20
I am working in access project, so the backend of the system is SQL, I tried to build a query to retrieve the data based on the date, the date appear in different form in a text box, so when I put the date in the text box and run the query I need the query to give me the data based on the date in the Text box. I tried to put in the query as following
Like [forms]![Main]![Text49]

but its not working like regular Ms Access query, it keeps giving me (Your entry cannot be converted to a valid date time value), can you help me with this query please?
This is the code for the query
Expand|Select|Wrap|Line Numbers
  1.  INSERT INTO dbo.AccTDailyT
  2.                         (No, AccountNo, AccountName, AccountName2, Balance, TransDate)
  3. SELECT      No, AccountNo, AccountName, AccountName2, Balance, TransDate
  4. FROM          dbo.Acct_DataT
  5. ORDER BY No 
Thank you in advance for your help
Oct 18 '12 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 10K+
P: 12,430
It's a pretty clear message, whatever date you're trying to insert isn't a real date.
Oct 18 '12 #2

P: 20
Okay, I believe in access project you need to put another formula to run this query, not like the regular ms access when you put this formula its working fine
Like [forms]![Main]![Text49]
and it shows you the correct data,
But in MS Access project - SQL it doesn’t work,
Can you please help me with what formula that I have to but in the criteria or give me the correct code??
[IMG]C:\Documents and Settings\malsamhouri\My Documents\My Pictures\untitled[/IMG]
Oct 18 '12 #3

Expert Mod 10K+
P: 12,430
Are you talking about your other thread? You have no where criteria in the SQL you posted above.

Also, I can't see the picture you posted. You forgot to attach it to the thread.
Oct 18 '12 #4

Expert Mod 2.5K+
P: 3,482
Also, if you are simply looking for exact dates, there is no need for the "Like" statement. Date comparison can simpy use "=". You may need to use the date delimiter "#" concatenated around the date your are looking for, however.
Oct 19 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.