One of the fields in the form, AImportDate, is a date/time field without a specified format. I have obtained the value of the assessment date and stored it as a variable dtDate, Dim'd as Date. For my test file, dtDate properly returns '05/03/2010' (5 March). I then run the following SQL command:
Expand|Select|Wrap|Line Numbers
- strSQL = "UPDATE " & strWriteTable & " " _
- & "SET AImportPropIndex = " & intPropIndex & ", " _
- & "AImportDate = " & dtDate & ";"
- 'DoCmd.SetWarnings False
- DoCmd.RunSQL strSQL
- DoCmd.SetWarnings True
I had created the table with this SQL statement earlier in the module:
Expand|Select|Wrap|Line Numbers
- strSQL = "CREATE TABLE " & strWriteTable & " " _
- & "(AImportIndex INT, " _
- & "AssessmentItemIndex INT NOT NULL, " _
- & "AssessmentRShort INT, " _
- & "AssessmentRFreeText TEXT(255), " _
- & "AssessmentRComment TEXT(255), " _
- & "AImportPropIndex INT, " _
- & "AImportDate DATETIME, " _
- & "PRIMARY KEY (AImportIndex));"
- DoCmd.RunSQL strSQL