Hi All,
I have a form that a user users to update records in the database. This form has all unbound fields. These unbound fields are populated from a listbox by the user double clicking on the appropriate record for UDPATE from the listbox. The form contains some date fields and these dates can be left blank or without a date if the user so chooses. My code to update a record works perfect if all the date fields are populated, but if one is left blank or empty or without a date, I get the following error:
"Run-time error '3075: Syntax error in date in query expression '#'. I have searched the internet before posting on here, to figure out a solution to accept a null value or empty value for the dates, but no luck. Has anyone run into this before or can provide some help/direction.
Here is my sql update statement
sql = "UPDATE [corrlog] SET [unitcode] = '" & txtUnitCodeInput & "', subject = '" & Me.txtSubjectInput & _
"',received = #" & txtReceivedInput & "#,assigned = #" & txtAssignedInput & "#,duedate = #" & txtDueDateInput & _
"#,reviewdate = #" & txtReviewedInput & "#,returneddate = #" & txtReturnedInput & _
"#,closeddate = #" & txtClosedInput & "' WHERE [caseno] ='" & Me.lstInfo & "'"
I have checked the table structure to make sure all columns are not required and they are set as such. Any help will be greatly appreciated. Thanks in advance.