I am having major trouble with a simple date, and it's driving me insane.
I am working on a database to store user, asset, software and license info for an IT company. There is a requirement for a table to record every transaction, an audit trail in effect.
I am working in an Access 2000 adp project connecting to an MS-SQL 2000 database.
This:
produces the date 01/01/1900 even though I have actually hard coded today's date into it. I reached this stage after both the Date and Now functions throw an error connecting to a method or property of the OLE object. If I go like this:
I get the connection error. If I don't include the concatenated ' either side of the Date, it enters 1900 (or perhaps the other way round).
Anyway, it doesn't work. The field is formatted to datetime. What am I doing wrong?
Nick
I am working on a database to store user, asset, software and license info for an IT company. There is a requirement for a table to record every transaction, an audit trail in effect.
I am working in an Access 2000 adp project connecting to an MS-SQL 2000 database.
This:
Code:
On Error GoTo Err_cmdSaveClose_Click
Dim concAction As String
Dim thisUser As String
Dim analyst As String
Dim myDate As Date
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
concAction = "Added asset " & Me.assetNumber.Value
thisUser = Forms!frmMain!ctlHiddenUser
myDate = Date
strSQL = "INSERT INTO tblJournal (journalType, analystID, concaction, recordDate) " & _
"VALUES (1,'" & thisUser & "', '" & concAction & "', 15-10-2004);"
DoCmd.RunSQL (strSQL)
Exit_cmdSaveClose_Click:
Exit Sub
Err_cmdSaveClose_Click:
MsgBox Err.Description
Resume Exit_cmdSaveClose_Click
produces the date 01/01/1900 even though I have actually hard coded today's date into it. I reached this stage after both the Date and Now functions throw an error connecting to a method or property of the OLE object. If I go like this:
Code:
strSQL = "INSERT INTO tblJournal (journalType, analystID, concaction, recordDate) " & _
"VALUES (1,'" & thisUser & "', '" & concAction & "', '" & Date "');"
Anyway, it doesn't work. The field is formatted to datetime. What am I doing wrong?
Nick