Fredgarner
Technical User
Does anyone know why this is returning the error message 'Compile error: Variable not defined'?
Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.
Private Sub Detail_Click()
End Sub
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click
Dim stDocName As String
If Opt_Reports = 1 Then
lcReportName = "Shareholdings (by intermediary)"
ElseIf Opt_Reports = 2 Then
lcReportName = "Shareholdings (by share class)"
ElseIf Opt_Reports = 3 Then
lcReportName = "Shareholdings (by shareholder)"
Else
lcReportName = "" 'Force Error
End If
DoCmd.OpenReport stDocName, acPreview
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click
End Sub
Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.
Private Sub Detail_Click()
End Sub
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click
Dim stDocName As String
If Opt_Reports = 1 Then
lcReportName = "Shareholdings (by intermediary)"
ElseIf Opt_Reports = 2 Then
lcReportName = "Shareholdings (by share class)"
ElseIf Opt_Reports = 3 Then
lcReportName = "Shareholdings (by shareholder)"
Else
lcReportName = "" 'Force Error
End If
DoCmd.OpenReport stDocName, acPreview
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click
End Sub