Link to home
Start Free TrialLog in
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.
ASKER CERTIFIED SOLUTION
Avatar of RossWilko
RossWilko

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vbnewbie01
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.