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
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