noccy Posted January 24, 2006 Posted January 24, 2006 Hi! I am trying to to SQL updates with an access database. One of the fields is a Date/Time field, and the problem occurs when I do n ot want to insert a date. Now I have: Dim strDate as String = Format(myDate, "yyyy-MM-dd HH:mm:ss") Dim strSQL as String = "Update myTable SET date1 ='" & strDate & "' WHERE..." This works fine as long as I have a date to insert... I have tried stuff like... Update myTable SET date1 ='" & IIF(strDate="", "Null", strDate) & "' ...but I can't make it work... Does anyone know how to update datetimefields with null values? noccy Quote
kejpa Posted January 24, 2006 Posted January 24, 2006 Hi, First of all I have to say.... You should use parameters, make things a lot easier If you still want to create a string there shall be no quotes around the NULL keyword... Update myTable SET date1 =null where 1=2 HTH /Kejpa Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.