Insert into Date field

Maritza

Information *****
Local time
Today, 03:54
Joined
Nov 13, 2002
Messages
54
I have the following command that I'm using in Access 2000.

cmdInsertInfo.CommandText = "insert into tblMainHistory (DateDeployed, DateDeparted )" & _
"values ('" & IIf(IsNull(rsGetData!DateDeployed = True), Empty, rsGetData!DateDeployed) & _
"','" & IIf(IsNull(rsGetData!DateDeparted = True), Empty, rsGetData!DateDeparted) & "')"

cmdInsertInfo.Execute



It works without problems if I have dates in the fields to be inserted into the History table, but if the fields are NULL I get an error. What is the proper way to insert Null or empty values into a date field? I also tried replacing "Empty" with "NULL" with and without commas. Both fields are the same data type (short date) in the Main table and the History Table.

Thanks for your help!

Maritza
 

Users who are viewing this thread

Back
Top Bottom