Hello Guys,
I have a cmd button which opens a Report from selecting a name from a comboBox.
I've formatted to report to give me data within 30 days.
However if one of those names does not have anything within those 30 days, it gives me error message 2427 (Invalid use of Null) and takes me to debug it
The error highlights t = CDate(Me.Expires)
I believe I am supposed to enter IsNull somewhere but where?
Also, how do I enter a MsgBox if there is nothing to see?
Thank you for the help
Here is my code: :banghead:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.LicName.Visible = False
Me.State.Visible = False
Dim t As Date
t = CDate(Me.Expires)
If Me.LicName = "State PE License" Then
Me.LicText = Me.State
Else
Me.LicText = Me.LicName
End If
If Date > t And t > DateTime.DateAdd("d", 30, Date) Then
Me.Expires.ForeColor = vbRed
Me.Expires.FontBold = True
Else
Me.Expires.ForeColor = vbBlack
Me.Expires.FontBold = False
End If
I have a cmd button which opens a Report from selecting a name from a comboBox.
I've formatted to report to give me data within 30 days.
However if one of those names does not have anything within those 30 days, it gives me error message 2427 (Invalid use of Null) and takes me to debug it
The error highlights t = CDate(Me.Expires)
I believe I am supposed to enter IsNull somewhere but where?
Also, how do I enter a MsgBox if there is nothing to see?
Thank you for the help
Here is my code: :banghead:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.LicName.Visible = False
Me.State.Visible = False
Dim t As Date
t = CDate(Me.Expires)
If Me.LicName = "State PE License" Then
Me.LicText = Me.State
Else
Me.LicText = Me.LicName
End If
If Date > t And t > DateTime.DateAdd("d", 30, Date) Then
Me.Expires.ForeColor = vbRed
Me.Expires.FontBold = True
Else
Me.Expires.ForeColor = vbBlack
Me.Expires.FontBold = False
End If