I have an update statement that updates a table based on form entries. The entries are a combination of text values and dates - 11 in total. The form is unbound. The statement executes properly when all form fields are filled in. If an entry is left blank I'm thrown a syntax error:
Run-time error '3075'
Syntax error in date in query expression '#'.
The code is as follows:
Code:
SQLUpdate = "UPDATE EMS_Main SET DSP3Date = #" & Me!DSP3Date & "#, DSP3Result = '" & Me!DSP3Result & "', DSP5Date = #" & Me!DSP5Date & "#, DSP5Result = '" & Me!DSP5Result & "', BCDate = #" & Me!BCDate & "#, BCResult = '" & Me!BCResult & "', BackgroundNumber = '" & BackgroundNumber & "', OFACDate = #" & Me!OFACDate & "#, OFACResult = '" & Me!OFACResult & "', FDate = #" & Me!FDate & "#, FResult = '" & Me!FResult & "' WHERE EmployeeName = '" & Employee & "'"
I'm not sure how to code for blank entries. My only thought is that I can write something to dynamically build the sql statement based upon what entries are made. I'd rather not do that though.
Any help would be appreciated.