I have the code below, which opens a report. I have three message boxes - two to ask for information to be selected on the form; and one info box. I have exactly! the same code to open a form and it runs fine (I've checked them against each other letter by letter). However, this report code insists it's missing an "end if". I have several command buttons for different reports, and they all want an extra 'end if'.
My question - where should I be putting that 'end if'?
Private Sub NAME_Click()
On Error GoTo Err_NAME_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(Me![Combo01]) Then
MsgBox "Please choose a cloud from the drop down list."
Else
If IsNull(Me![Combo02]) Then
MsgBox "Please choose a project from the drop down list."
Else
If MsgBox("Preview assessment report for all issues. This report contains no details about SAC/permit requirements.", vbOKCancel) = vbOK Then
stDocName = "rptAssessmentYesNo"
stLinkCriteria = "[ProjectID]=" & Me![Combo02]
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria, , Me![Combo02]
End If
Me.Combo02 = Null
End If
Exit_NAME_Click:
Exit Sub
Err_NAME_Click:
MsgBox Err.Description
Resume Exit_NAME_Click
NAME_Click_Exit:
Exit Sub
NAME_Click_Err:
MsgBox Error$
Resume NAME_Click_Exit
End Sub
My question - where should I be putting that 'end if'?
Private Sub NAME_Click()
On Error GoTo Err_NAME_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(Me![Combo01]) Then
MsgBox "Please choose a cloud from the drop down list."
Else
If IsNull(Me![Combo02]) Then
MsgBox "Please choose a project from the drop down list."
Else
If MsgBox("Preview assessment report for all issues. This report contains no details about SAC/permit requirements.", vbOKCancel) = vbOK Then
stDocName = "rptAssessmentYesNo"
stLinkCriteria = "[ProjectID]=" & Me![Combo02]
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria, , Me![Combo02]
End If
Me.Combo02 = Null
End If
Exit_NAME_Click:
Exit Sub
Err_NAME_Click:
MsgBox Err.Description
Resume Exit_NAME_Click
NAME_Click_Exit:
Exit Sub
NAME_Click_Err:
MsgBox Error$
Resume NAME_Click_Exit
End Sub