I am having problems getting the syntax correct for the following code. I am trying to set the combobox [cboStartOperatingUnit] on the subform [frmReportsSUB]. The subform is located on form [frmReports].
The error occurs on the line with ***.
The exact error message is:
2450 HR Database can't find the form 'frmReportsSUB' referred to in a macro expression or Visual Basic Code.
* The form you referenced may be closed or may not exist in this database.
* HR Database may have encountered a compile error in a Visual Basic module for the form.
The subform name is spelled correctly and does exist. And, the line "SetReportVariables Forms![frmReports]![lstReports]" is correctly identifing the item in the listbox [lstReports].
Please help! I am very inexperienced with VB (in fact, it scares me!) and don't really understand what is going on....
------
Public Sub VisibleReportParams()
'Sets the visible properties of the parameter fields once a report is selected by user.
On Error GoTo ErrHandler
SetReportVariables Forms![frmReports]![lstReports]
If blnSelectOperUnit = True Then
***Forms!frmReportsSUB!cboStartOperatingUnit.Visible = True
Forms!frmReportsSUB!cboEndOperatingUnit.Visible = True
Else
Forms!frmReportsSUB!cboStartOperatingUnit.Visible = False
Forms!frmReportsSUB!cboEndOperatingUnit.Visible = False
End If
End Sub
The error occurs on the line with ***.
The exact error message is:
2450 HR Database can't find the form 'frmReportsSUB' referred to in a macro expression or Visual Basic Code.
* The form you referenced may be closed or may not exist in this database.
* HR Database may have encountered a compile error in a Visual Basic module for the form.
The subform name is spelled correctly and does exist. And, the line "SetReportVariables Forms![frmReports]![lstReports]" is correctly identifing the item in the listbox [lstReports].
Please help! I am very inexperienced with VB (in fact, it scares me!) and don't really understand what is going on....
------
Public Sub VisibleReportParams()
'Sets the visible properties of the parameter fields once a report is selected by user.
On Error GoTo ErrHandler
SetReportVariables Forms![frmReports]![lstReports]
If blnSelectOperUnit = True Then
***Forms!frmReportsSUB!cboStartOperatingUnit.Visible = True
Forms!frmReportsSUB!cboEndOperatingUnit.Visible = True
Else
Forms!frmReportsSUB!cboStartOperatingUnit.Visible = False
Forms!frmReportsSUB!cboEndOperatingUnit.Visible = False
End If
End Sub