In that case, I think your logic is wrong. Shouldn't it be:
Private Sub Form_Load()
If glevel <> "MANAGER" Then
cmdDelete.Enabled = False
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes"
Else
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes
WHERE [DEC_CODE <> 'WI']"
End If
End Sub
If it's a manager, you want them to see everything. If it's not a manager,
you want them to see everything except WI.
Dan @BCBS said:
No that's not what I want...
I need "If manager then enable WI" (withdrawn) only managers can withdraw
the case...
"WI" is one of the choices in the combo box, not the entire box...
Private Sub Form_Load()
If glevel <> "MANAGER" Then
cmdDelete.Enabled = False
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes"
Else
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes
WHERE [DEC_CODE = 'WI']"
End If
End Sub
////////////
Is this possible??
:
If you have records with WI, then the problem is in the rowsource statement.
Have you tried the square brackets?
If there are zero records with 'WI', you'll get no records for your combo.
Isn't this what you wanted?
Barry
:
There are 2050 records with DEC_CODE of 'WI'...
But even if there were zero the code still removes all the values from the
drop down..??
:
Dan,
The real question is, how many records have a DEC_CODE of 'WI'? Test this by
pasting the second select statement into the sql design view of a query and
seeing the results. You might also need to enclose DEC_CODE in square
brackets to get it to work.
Barry
:
Maybe disabled was not the best term to use - all the values are missing when
I use the code below. The combo box opens but there are no choices...
Yes the records seem fine, there are 63102 records all have a DEC_CODE from
the combo box. But again, this code just removes the choices from the box.
Help
:
Dan,
I'm not sure why the combobox would be disabled. All you're doing is
changing the rowsource. Have you looked at the records that each sql
statement returns? Do they seem correct? When you say the combobox is
disabled, do you mean its Enabled property is set to false (grayed out)?
Barry
:
Is this even possible....?
I've received some help on this (title Disable drop down) but I'm still
struggling.
I need to make one specific item in a combo box enabled only for certain
people.
Is it possible to specify one value from a combo box..
This code disables the entire combo box no matter what the glevel.
Private Sub Form_Load()
If glevel <> "MANAGER" Then
cmdDelete.Enabled = False
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes"
Else
Me.TR_DECISION.RowSource = "SELECT DEC_CODE From tblDecisionCodes
WHERE (DEC_CODE = 'WI')"
End If
End Sub