Hi all. I need some help please.
I am trying to change Row Source of ombobox depend of function "GetAccessLevel"
I have
and I have combobox with name "cboInspectors" and Row Source: tblInspectors and Row Sours Type: Table/Query
What I want is:
If I have GetAccessLevel = 1 then
I have the whole list in tblInspectors to be able to be chosen and visible into cboInspectors
Else If GetAccessLevel = 2 then
the list into cboInspectors to be only with name with the name that was logged
I try with this but it doesn't work:
I am trying to change Row Source of ombobox depend of function "GetAccessLevel"
I have
Code:
Public Function GetAccessLevel()
GetAccessLevel = Nz(DLookup("AccessLevel", "tblUsers", "UserName='" & GetUserName & "'"), 0)
End Function
and I have combobox with name "cboInspectors" and Row Source: tblInspectors and Row Sours Type: Table/Query
What I want is:
If I have GetAccessLevel = 1 then
I have the whole list in tblInspectors to be able to be chosen and visible into cboInspectors
Else If GetAccessLevel = 2 then
the list into cboInspectors to be only with name with the name that was logged
I try with this but it doesn't work:
Code:
Private Sub Form_Load()
If GetAccessLevel = 1 Then
Me.cboInspectors.RowSource = "qryInspectors"
Me.cboInspectors.RowSourceType = "Table/Query"
ElseIf GetAccessLevel = 2 Then
Me.cboInspectors.RowSource = "qryWelcomeUserDZK"
Me.cboInspectors.RowSourceType = "Table/Query"
End If
End Sub