Conditional ComboBox

  • Thread starter Thread starter nwilliams via AccessMonster.com
  • Start date Start date
N

nwilliams via AccessMonster.com

I have a combo box that allows users to choose a staffID, however if a
certain item is selected in a previous combo box then my list of staffID's
needs to be limited to a certain few. Currently this is what I have.

If 27 < Service.Value < 40 Then
Me.STAFFID.DropDown="24","159","176","321","326","337","383","124","390",
"409"
End If

The certain item is the service. So if the service.value is between the range
then the staffID's should be limited to only certain ID's otherwise it should
be as I had it before an open range.

This code does not compile obviously, any ideas?
 
Assuming your combo box "Row Source Type" is set to "Value List", then:



If 27 < Service AND Service < 40 Then
Me.StaffID.RowSource="24, 159, 176, 321, 326, 337, 383, 124, 390,
409"
End if



Hoping it may help,
Vanderghast, Access MVP
 
You pointed out my error so this is what I did..thanks for your help

If 27 <= Service And Service <= 40 Then
MsgBox "You must be a Master Counselor"
Me.StaffID.RowSourceType = "Value List"
Me.StaffID.RowSource = "24; 159; 176; 321; 326; 337; 383; 124; 390; 409;"
Else
Me.StaffID.RowSourceType = "Table/Query"
Me.StaffID.RowSource = strSQL
End If

Michel said:
Assuming your combo box "Row Source Type" is set to "Value List", then:

If 27 < Service AND Service < 40 Then
Me.StaffID.RowSource="24, 159, 176, 321, 326, 337, 383, 124, 390,
409"
End if

Hoping it may help,
Vanderghast, Access MVP
I have a combo box that allows users to choose a staffID, however if a
certain item is selected in a previous combo box then my list of staffID's
[quoted text clipped - 12 lines]
This code does not compile obviously, any ideas?
 
Back
Top