Getting "Compile Error: Object required" - TechRepublic
Question
February 27, 2009 at 07:10 AM
atorres

Getting “Compile Error: Object required”

by atorres . Updated 17 years, 4 months ago

I have the follwing VBA code in an Access form to hide and unhide Combobox and Listbox; but I am getting a “Compile Error: Object required.” I would appreciate anyone that could look at the code and tell me what I am doing wrong. If I need to post more info, let me know.

Public Sub cmbRptName_AfterUpdate()

Dim intLvlID As Integer

intLvlID = “Select LevelID From tblReports ” & _
“WHERE ReportID = ” & cmbRptName.Value
If IsNull(intLvlID) Then
Me.cmbRptName.Visible = True
Me.cmbSup.Visible = False
Me.lstAssociate.Visible = False
IfElse intLvlID = 1
Me.cmbSup.Visible = False
Me.lstAssociate.Visible = False
IfElse intLvlID = 2
Me.cmbSup.Visible = True
Me.lstAssociate.Visible = False
Else
Me.cmbSup.Visible = True
Me.lstAssociate.Visible = True
End If

Set intLvlID = Nothing

End Sub

This discussion is locked

All Comments