I'm trying to trap errors, such as whether or not a user actually entered a value in a text box that is passed to a query. For example, the control txtControl had no data entered, and when the user hits the next button my code looks like this:
Dim stDocName As String
Dim stLinkCriteria As String
Dim stEmptyString As String
stDocName = "frmInfo"
stEmptyString = Me!txtControl
If stEmptyString = "" Then
MsgBox "Please enter a value or choose a different Entry Method", vbOKOnly
Else
stLinkCriteria = "[Column]=" & Me![txtControl]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
I usually get an "Invalid Use of Null" error, but sometimes (somehow) it displays my message box the way I'd expect to see it. Weird. Thanks in advance.
V
Dim stDocName As String
Dim stLinkCriteria As String
Dim stEmptyString As String
stDocName = "frmInfo"
stEmptyString = Me!txtControl
If stEmptyString = "" Then
MsgBox "Please enter a value or choose a different Entry Method", vbOKOnly
Else
stLinkCriteria = "[Column]=" & Me![txtControl]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
I usually get an "Invalid Use of Null" error, but sometimes (somehow) it displays my message box the way I'd expect to see it. Weird. Thanks in advance.
V