So I have this nice little function to convert any Dates in SQL type dates:
Public Function makeSQLDate(dtmDate) As String
If IsDate(dtmDate) Then
makeSQLDate=Format(CDate(dtmDate),"\#yyyy\-mm\-dd\#", vbMonday, vbFirstFourDays)
Else
makeSQLDate = ""
End If
End Function
And I am trying to insert a new data entry into a table:
DoCmd.RunSQL "INSERT INTO [tblTable] (...[dtmDate]...) VALUES (...makeSQLDate(strDate)...);"
The problem is, [strDate] CAN BE NULL (the user did not enter anything in the form, which is ok, there MUST be the case where the field is left empty). But how do I INSERT INTO a Null Date???
Regards
waldemar
Public Function makeSQLDate(dtmDate) As String
If IsDate(dtmDate) Then
makeSQLDate=Format(CDate(dtmDate),"\#yyyy\-mm\-dd\#", vbMonday, vbFirstFourDays)
Else
makeSQLDate = ""
End If
End Function
And I am trying to insert a new data entry into a table:
DoCmd.RunSQL "INSERT INTO [tblTable] (...[dtmDate]...) VALUES (...makeSQLDate(strDate)...);"
The problem is, [strDate] CAN BE NULL (the user did not enter anything in the form, which is ok, there MUST be the case where the field is left empty). But how do I INSERT INTO a Null Date???
Regards
waldemar