Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date problem

Status
Not open for further replies.

Borracho1

Programmer
Apr 2, 2005
28
BE
does anybody know what i am doing wrong in this code?

I am trying to filter an appointment and at first i thought everything worked fine until i saw yesterday that it only works with dates above 12 ??
Other dates work fine without any problem.

Private Sub cmdafspraakbewerken_Click()
frmSollicitantInterview.Show
With frmSollicitantInterview.Interview
.RecordSource = " select * from interview where sollicitantid = " & Interview.Recordset.Fields("sollicitantid") & _
"And Datum =# " & Interview.Recordset.Fields("datum") & " #" & _
"and uur =# " & Interview.Recordset.Fields("uur") & " #" & _
"and opdrachtid = " & Interview.Recordset.Fields("opdrachtid") & " "
.Refresh

End With
End Sub

first i thought it had something to do with the notation in my database and the one character date but when i change all this in database and in code with the format function it still doesn't work.

Any tips or help would be very appreciated

borracho
 
Can you do a debug.print of the sql statement and post it please.

Patrick
 
One guess, your date settings differ from US dates?

If so, you'll need to format the dates to an unambiguous format, for instance:

[tt]...Datum =# " & format$(Interview.Recordset.Fields("datum"),"yyyy-mm-dd") & " #"[/tt]

[tt]"mm\/dd\/yyyy"[/tt] can also be used.

Roy-Vidar
 

ok thanks a lot RoyVidar, your code did the trick.

borracho1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top