Full Version: Select Case ..... End Select
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Ozarka
having hard time enabling some command buttons based on this criteria

1. a listbox is populated with 3 fields (userid,title,allowforms). allowforms is a field which contains actual form name. this is becasue i could have managers hitting this form and i only want certain manager to click certain buttons.

the select case is not working....

Dim strCurrentForm As String
Dim qType As String
qType = Me.ListUserID.Column(1, 0)
strCurrentForm = Application.CurrentObjectName

Select Case qType
Case qType = "supervisor" And Me.ListUserID.Column(2, 0) = strCurrentForm
MsgBox "case 1"
Me.cmdFCPull.Enabled = True
Case qType = "manager" And Me.ListUserID.Column(2, 0) = strCurrentForm
me.cmdInvLookup.Enabled = True
MsgBox "case 2"
Case qType = "supervisor" And IsNull(Me.ListUserID.Column(2,0))
Me.txtUserName.Visible = True
Me.txtUserName.Value = Me.ListUserID.Column(3, 0)
MsgBox "case 3"
Case Not qType = "supervior" Or Not qType = "manager"
Me.cmdFCPull.Enabled = True
Me.cmdQuit.Enabled = True
MsgBox "case 4"
End Select
Jack Cowley
Search Access help for Select Case Statement (note that 'Statement' is not plural). There is no '=' sign between Case qType and the string...

hth,
Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.