one value in a combo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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,

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
 
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..??
 
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
 
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??
 
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??




Barry Gilbert said:
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
 
Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




Barry Gilbert said:
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??




Barry Gilbert said:
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
 
This:
WHERE [DEC_CODE <> 'WI']

should be this:
WHERE [DEC_CODE] <> 'WI'

Barry

Dan @BCBS said:
Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




Barry Gilbert said:
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
 
No difference, still an empty combo box.
I tried WHERE [DEC_CODE] <> 'WI'
and
I tried WHERE [DEC_CODE] = 'WI'

Both ways empty for manager and non-manager...
I also removed "cmdDelete.Enabled = False" which disables a command button
if not a manager.

Everything we have tried just removes all the choices from the combo box.????


Barry Gilbert said:
This:
WHERE [DEC_CODE <> 'WI']

should be this:
WHERE [DEC_CODE] <> 'WI'

Barry

Dan @BCBS said:
Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




Barry Gilbert said:
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.

:

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
 
Unfortunately, I don't think I can help anymore without seeing it firsthand.
Would you be able to send me a copy?

Dan @BCBS said:
No difference, still an empty combo box.
I tried WHERE [DEC_CODE] <> 'WI'
and
I tried WHERE [DEC_CODE] = 'WI'

Both ways empty for manager and non-manager...
I also removed "cmdDelete.Enabled = False" which disables a command button
if not a manager.

Everything we have tried just removes all the choices from the combo box.????


Barry Gilbert said:
This:
WHERE [DEC_CODE <> 'WI']

should be this:
WHERE [DEC_CODE] <> 'WI'

Barry

Dan @BCBS said:
Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




:

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.

:

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
 
Sure, to what email address, I cannot attach anything to this message...
I'm sure you don't want the entire database, but I can send you whats in the
table, form and form code...

Thanks for the help, if this can be done, it would solve a lot of issues we
are having..

Barry Gilbert said:
Unfortunately, I don't think I can help anymore without seeing it firsthand.
Would you be able to send me a copy?

Dan @BCBS said:
No difference, still an empty combo box.
I tried WHERE [DEC_CODE] <> 'WI'
and
I tried WHERE [DEC_CODE] = 'WI'

Both ways empty for manager and non-manager...
I also removed "cmdDelete.Enabled = False" which disables a command button
if not a manager.

Everything we have tried just removes all the choices from the combo box.????


Barry Gilbert said:
This:
WHERE [DEC_CODE <> 'WI']

should be this:
WHERE [DEC_CODE] <> 'WI'

Barry

:

Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




:

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.

:

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
 
barry dot gilbert at hunterdouglas dot com

Send me what I need to be able to recreate the problem.

Barry

Dan @BCBS said:
Sure, to what email address, I cannot attach anything to this message...
I'm sure you don't want the entire database, but I can send you whats in the
table, form and form code...

Thanks for the help, if this can be done, it would solve a lot of issues we
are having..

Barry Gilbert said:
Unfortunately, I don't think I can help anymore without seeing it firsthand.
Would you be able to send me a copy?

Dan @BCBS said:
No difference, still an empty combo box.
I tried WHERE [DEC_CODE] <> 'WI'
and
I tried WHERE [DEC_CODE] = 'WI'

Both ways empty for manager and non-manager...
I also removed "cmdDelete.Enabled = False" which disables a command button
if not a manager.

Everything we have tried just removes all the choices from the combo box.????


:

This:
WHERE [DEC_CODE <> 'WI']

should be this:
WHERE [DEC_CODE] <> 'WI'

Barry

:

Either way (<> 'WI' or ='WI') they both just eliminate all the choices and I
get a combo box that is empty..




:

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.

:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top