|
-
Mar 4th, 2003, 01:15 PM
#1
Thread Starter
Member
sql problem.
rs.Open "SELECT * FROM [transaction] WHERE t_date=" & Date, db, adOpenStatic, adLockOptimistic
hi...
this sql query didn't work?????
t_date is a date/time (data type) field in access database...
i can't compare it with the current date.....so that all those records with the current date can display in a listview control...
in the database there is a few records which its t_date field is current date....but when i compare it with the sql query above...it didn't match and didn't display in the listview control..
how to compare it??
what is the problem??
-
Mar 4th, 2003, 01:44 PM
#2
Try this:
VB Code:
rs.Open "SELECT * FROM [transaction] WHERE t_date=#" & Format(Date, "mm/dd/yyyy") & "#", db, adOpenStatic, adLockOptimistic
Unless yopu are using SQL Server, inwhich case try this:
VB Code:
rs.Open "SELECT * FROM [transaction] WHERE t_date='" & Format(Date, "mm/dd/yyyy") & "'", db, adOpenStatic, adLockOptimistic
-
Mar 4th, 2003, 01:54 PM
#3
Frenzied Member
You have to surround dates w/a # sign in Access
-
Mar 4th, 2003, 01:55 PM
#4
Thread Starter
Member
yeah it works..
actually what is the problem of my code??
may u clarify me???
what is the # means??
-
Mar 4th, 2003, 01:57 PM
#5
Thread Starter
Member
-
Mar 4th, 2003, 01:58 PM
#6
Addicted Member
TRY THIS
Dim rs As New ADODB.Recordset
str = "Select * from Transaction where t_date < " & "#" & DTP1.Value & "#"
rs.Open str, Connection.cn, adOpenKeyset, adLockOptimistic
BE HAPPY BE WELL!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|