Avatar of vbnewbie01
vbnewbie01
 asked on

insert NULL into access database

hi there; i have the following udate query:

Dim dtNow As DateTime = DateTime.Now
Dim strDateTime As String = dtNow.AddHours(3).ToString

If blnConfirmedByEmail = False And blnConfirmedByPhone = False Then
            'set strDateTime equal to Null here
 End If
       
        Dim strSQL As String = "UPDATE tblReservations SET " _
        & "fldReservationConfirmedByEmail=" & blnConfirmedByEmail & ", " _
        & "fldReservationConfirmedByPhone=" & blnConfirmedByPhone & ", " _
        & "fldReservationConfirmedDate='" & strDateTime & "' " _
        & "WHERE fldReservationID=" & intReservationID

as you can see, if no checkboxes are checked, then i want to update fldReservationConfirmedDate to NULL

any suggestions?

thanks all.
ASP.NET

Avatar of undefined
Last Comment
vbnewbie01

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
RossWilko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Éric Moreau

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
vbnewbie01

ASKER
hi, guys; thank you both very much for your response.  i had been trying to set strDateTime = Null (without the quotes) and couldn't figure out why this wasn't working.  I then added the quotes and it still didn't work.

turns out, as you both suggested, i needed to remove the single quotes from around strDateTime in my query.

anyway, i have split the points to accomodate emoreau's slightly more detailed solution.

thanks again.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes