date miss match

  • Thread starter Thread starter supaplex
  • Start date Start date
S

supaplex

Guest
i have a prob' in my database with the dates ...

i have a textbox that u have to insert a date
and the syntax is that :
Private Sub txtDate_AfterUpdate()
Dim rstDates As DAO.Recordset, intCnt As Integer

"""""""Set rstDates = CurrentDb.OpenRecordset("select datelist.* from datelist where datelist.dtedate = #" & Me!txtDate & "#;", dbOpenDynaset)

If rstDates.EOF Then
For intCnt = 1 To 12
rstDates.AddNew
rstDates!num = intCnt
rstDates!dteDate = Me!txtDate
rstDates.Update
Next
Set rstDates = Nothing
End If
DoCmd.ApplyFilter , "dteDate =#" & Me!txtDate & "#"
End Sub"""""

but i dont understand , when i put in the date 01/01/03 it works
and shows me a list , 02/02/03 it works
but lets say 02/03/03 its not responding like some kind of bug !
and so on ... 5/5/05 works 01/02/03 and the mm/dd gets beckround , once i tested to upside the whole date like :
2003/03/02 and it worked !
what to do ???
thanx
 
the date should be formatted either as Format(Me!txtDate,"\#mm\/dd\/yyyy\#") or Format(Me!txtDate,"\#yyyy\-mm\-dd\#"). Another workaround is converting it to a double size number.
I.e.: DoCmd.ApplyFilter , "CDbl(dteDate)=" & CDbl(Me!txtDate)
 

Users who are viewing this thread

Back
Top Bottom