sql errors out when field is blank

swmorin

Registered User.
Local time
Yesterday, 22:01
Joined
Jan 10, 2012
Messages
66
I have my sql field in ## marks for an update query written in VBA.

Code:
",tbl_instructor_dates.isdcw = #" & [Forms]![frm_instructor_misc_info_update]![ISDcw] & "# " & _


It works fine as long as the field is not blank. Unfortunately if the field is blank it equals null and gives me an error becauseof the #.

How do I avoid this
 
Do you want to not run the query if it's blank, or let it run with some sort of default value?
 
i want to let it run
 
With a default date, or setting the field to Null? Personally I might build the SQL without that field, but this should work for a default.

"...isdcw = #" & Nz([Forms]![frm_instructor_misc_info_update]![ISDcw], 1/1/2012) & "# "...

Might need quotes around the date.
 

Users who are viewing this thread

Back
Top Bottom