J
John
I'm firing off a report using a command button, but I want to make sure there
are not any null values on my form. I have 3 combo boxes that all need
values in order to generate the report properly. I have setup my code as
follows, but it is not producing the results. The message boxes all appear,
but the event is not cancelled to allow the user to select the information;
therefore an error is created on the report because no info was selected.
Please let me know what I'm doing wrong:
On the "click property" of the command button I have as follows:
Private Sub Command11_Click()
If IsNull(cmbdept.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select Department", vbRetryCancel, "Select
Department")
cmbdept.setfocus
Else
If IsNull(cmbpri1.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select 1st Prority", vbRetryCancel, "Select
Starting Priority")
cmbpri1.setfocus
Else
If IsNull(cmbpri2.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select 2nd Prority", vbRetryCancel, "Select
Ending Priority")
cmbpri2.setfocus
Else
End if
End if
End if
DoCmd.OpenReport "rptbypri", acViewPreview
DoCmd.Close acForm, "frmgendrpt", acSaveNo
End Sub
are not any null values on my form. I have 3 combo boxes that all need
values in order to generate the report properly. I have setup my code as
follows, but it is not producing the results. The message boxes all appear,
but the event is not cancelled to allow the user to select the information;
therefore an error is created on the report because no info was selected.
Please let me know what I'm doing wrong:
On the "click property" of the command button I have as follows:
Private Sub Command11_Click()
If IsNull(cmbdept.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select Department", vbRetryCancel, "Select
Department")
cmbdept.setfocus
Else
If IsNull(cmbpri1.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select 1st Prority", vbRetryCancel, "Select
Starting Priority")
cmbpri1.setfocus
Else
If IsNull(cmbpri2.Value) Then
Dim intResponse As Integer
intResponse = MsgBox("Please Select 2nd Prority", vbRetryCancel, "Select
Ending Priority")
cmbpri2.setfocus
Else
End if
End if
End if
DoCmd.OpenReport "rptbypri", acViewPreview
DoCmd.Close acForm, "frmgendrpt", acSaveNo
End Sub