Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to display an error message

Status
Not open for further replies.

BigBlueScreen

Technical User
Jul 23, 2004
31
US
Hi,

I'm trying to get a warning box message to appear when the "Case" box appears Null; using this code:


Public Sub LabelWizard(strQueryName As String)
' launch the label wizard with the specified query

On Error GoTo HandleErr

Application.Run "acwzmain.mlbl_Entry", strQueryName

ExitHere:
Exit Sub

HandleErr:
Select Case Err
Case 3574
MsgBox "You must install the wizards to create labels", _
vbCritical

Case Else
MsgBox Err & ": " & Err.Description, _
vbOKOnly, "Global Code.LabelWizard"
End Select
Resume ExitHere

End Sub


Private Sub OpenFormDialogBox_Click()
On Error GoTo Err_OpenFormDialogBox_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim VbMsgBoxResult As String
stDocName = "FRMDialogCaseBox"

DoCmd.OpenForm stDocName, , , stLinkCriteria

If "Case" = Null Then
VbMsgBoxResult = "You have entered an invalid combination; Please try again. "
MsgBox VbMsgBoxResult, vbExclamation + vbOKOnly, "Warning!"
Exit Sub
End If

Exit_OpenFormDialogBox_Click:
Exit Sub

Err_OpenFormDialogBox_Click:
MsgBox Err.Description
Resume Exit_OpenFormDialogBox_Click

End Sub


Any help getting this to work would be GREATLY appreciated..

Thanks,
Jd
 
To test for null use:

if isnull(myvalue) then

I haven't looked at the rest of the code.
 
Hi,

Made suggested change and now I'm getting a error on form "Object Required". Any idea what this is in reference to? If not, Can I send you a copy of my DB?

Thanks for your help,
Jd
 
Hi,
This is the code I'm using currently..

Private Sub OpenFormDialogBox_Click()
On Error GoTo Err_OpenFormDialogBox_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim VbMsgBoxResult As String

stDocName = "FRMDialogCaseBox"

DoCmd.OpenForm stDocName, , , stLinkCriteria

If IsNull(QRYPricingPerso.PersoCase) Then
VbMsgBoxResult = "You have entered an invalid combination; Please try again. "
MsgBox VbMsgBoxResult, vbExclamation + vbOKOnly, "Warning!"
Exit Sub
End If

Exit_OpenFormDialogBox_Click:
Exit Sub

Err_OpenFormDialogBox_Click:
MsgBox Err.Description
Resume Exit_OpenFormDialogBox_Click

End Sub

Thanks,
Jd
 
What are:
QRYPricingPerso and PersoCase
How do they relate to the form you've just opened?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top