Jumat, 08 Februari 2019

[MS_AccessPros] How to insert dates with Null value?

 

Dear All,

How to insert dates with null value? Here's my code: My problem is that
If the dates are null, it fails to insert anything. Please help

   Dim strPartStart As Date
    Dim strPartEnd As Date
    Dim strPartDays As Integer
    Dim strSQLTWO As String

    If Nz(ELookup("PartItineraryDate", "tblPartItinerary", "PartID=" &
Me.PartID), 0) = 0 Then
    strPartStart = Null
    strPartEnd = Null
    strPartDays = Null
    Else
    strPartStart = ELookup("PartItineraryDate", "tblPartItinerary",
"PartID=" & Me.PartID, "PartItineraryDate ASC")
    strPartEnd = ELookup("PartItineraryDate", "tblPartItinerary",
"PartID=" & Me.PartID, "PartItineraryDate DESC")
    strPartDays = strPartEnd - strPartStart + 1
    End If

    strSQLTWO = "UPDATE tblPart " & "SET [PartStart] = #" &
strPartStart & "#, " & _
        "[PartEnd] = #" & strPartEnd & "#, " & _
        "[PartDays] = " & strPartDays & " WHERE PartID = " & Me.PartID

    CurrentDb.Execute strSQLTWO, dbFailOnError

Best Regards,

Kevin

__._,_.___

Posted by: Kevin <qingqinga@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
AOL Ad
AOL Ad
AOL Ad
.

__,_._,___

Tidak ada komentar:

Posting Komentar