Wednesday, September 4, 2013

VBA Getting Runtime Error 94 Invalid Use of NULL

Being new to VBA, common errors like Run Time Error 94 can be hard to figure out. In this example, I was able to resolve the error by NOT declaring the variable CatVal as a String


Private Sub CommandButton3_Click()

' COMMENTING OUT THE NEXT LINE TOOK CARE OF THE RUN-TIME 94 INVALID USE OF 'NULLS
'Dim Cat2Val As String

With Me.Categories2
    Cat2Val = .Value
If IsNull(Cat2Val) Then
    MsgBox ("Select a value for Group 2")
Else:
    PubCat2Val = Cat2Val

End If
End With

End Sub

No comments:

Post a Comment