Strange date appearing in my table

aqif

Registered User.
Local time
Today, 20:42
Joined
Jul 9, 2001
Messages
158
Hi :)

I have got a very simple problem but tried everything but its giving me very odd result. I am just running a simple query which insert todays date

My code is

Dim strDate As String
strDate = Date

DoCmd.RunSQL "Insert into Table1(TDate) Values (" & strDate & ");"

And to most surprise I get date of last century like

Id TDate
12 31/12/1899 2:24:00 AM

I have even tried like CDate(Date()) but nothing is working :(

Any ideas about this viered problem?


Cheers!
Aqif
 
Perhaps you can strip some idea's from my code below.
It works for me.
Regards
DW



Private Sub Command0_Click()
Dim strWhere As String
Dim strSQL As String
strWhere = "EstimateNo = Forms!frmDetails!EstimateNo And Supp = Forms!frmDetails!Supp"
If IsNull(DLookup("EstimateNo", "tblDates", strWhere)) Then
strSQL = "INSERT INTO tblDates (EstimateNo, Supp, AuthorisationDate) SELECT EstimateNo, Supp, Date() FROM tblDetails WHERE " & strWhere
Else
strSQL = "UPDATE tblDates SET AuthorisationDate = Date() WHERE " & strWhere
End If
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub
 

Users who are viewing this thread

Back
Top Bottom