|
-
May 28th, 2000, 04:18 PM
#1
Thread Starter
New Member
here's my code:
Set rs1 = adconn.Execute("SELECT * from ApplDetail where appr = true and level1 = false and apprdate >= " & DTPicker1.Value)
apprdate is a date type data, in Access.
however, i failed to compare it with my DateTimePicker's value... it doesn't return the expected result.
the rs1 recordset is to be retrieved by a DataReport, so only SQL statements can be used...
can you help me this time?
thanks.
Yih
-
Jan 17th, 2001, 09:34 AM
#2
Lively Member
The problem probably is that you date from your db isn't the same format as the date from your dtpicker. You must make them the same format with the Format function :
Dim tempDate as date
tempDate = format(DTPicker1.value,"dd/mm/yy")
Then your comparison...
' Off course the format must be the same as the format you use in Access. It could also be mm/dd/yy or something else.
Breaker
(VB 6.0 ENT SP3 WIN 2000 PROF)=> WORK
(VB 6.0 ENT SP3 WIN ME)=> HOME -> Upgrade to .NET is coming
-
Jan 17th, 2001, 10:01 AM
#3
PowerPoster
lingtze, it because you miss out the "#" sign. For date in database, you must include the "#" at both end of the Date datatype.
Code:
Set rs1 = adconn.Execute("SELECT * from ApplDetail where appr = true and level1 = false and apprdate >= #" & DTPicker1.Value & "#);"
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
|