Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   How to use date as a condition in where clause of access Sql (http://www.go4expert.com/forums/date-condition-clause-access-sql-t3904/)

nadunalexander 17Apr2007 11:35

How to use date as a condition in where clause of access Sql
 
sqlStr1 = "SELECT * FROM sold WHERE dateOfSold=" & "3/29/2007"

I used this statement to retrive all the data they have value 3/29/2007 in the field of dateOfSold. When i try this statement this return empty record set. dateOfSold field is in access table sales. fieldtype is date/time. plese help me

pradeep 17Apr2007 17:32

Re: How to use date as a condition in where clause of access Sql
 
Code: SQL

SELECT * FROM sold WHERE dateOfSold=#1/1/2006#


nadunalexander 18Apr2007 09:17

Re: How to use date as a condition in where clause of access Sql
 
Thank you, for ur reply. I it is very usiful to me.

abstrused00388 29Jun2011 11:22

Re: How to use date as a condition in where clause of access Sql
 
This code was very much helpful i just modified it as :

Adodc1.RecordSource = "SELECT * FROM cm1 WHERE dt>=#1/1/2011 02:00:00 AM# AND dt<=#4/1/2011 02:00:00 PM#"

for searching a database using VB !

please let me know if there is a way to accept input from the user in a text box and use thm instead of the constant values that i have used


All times are GMT +5.5. The time now is 04:08.