Error message 97

IainG

Registered User.
Local time
Today, 11:21
Joined
May 6, 2009
Messages
25
Runtime Error message 94

Can anyone help with the following?
I am trying to use the MONTH function within the following procedure but I get an 'Invalid use of Null' error when [StartDate] is blank!

Private Sub StartDate_AfterUpdate()
Dim aMonth As Integer

aMonth = Month([StartDate])

If aMonth = 0 Then WOW = WOW
If aMonth = 1 Or aMonth = 2 Then WOW = 0.6
End Sub
 
Last edited:
Try using the Nz() function as follows

Code:
aMonth = Month(Nz(Me.StartDate,0))

Or

Code:
If Not IsNull(Me.StartDate) Then
    Date Found
    Do something here
Else
    No Date Found
    Do something here
End If

David
 
David,

That works just fine.

Many thanks.

Iain.
 

Users who are viewing this thread

Back
Top Bottom