limit combo boxes

J

jonneke

I would like to limit my combobox.

My combobox is called ComboBranches and has 2 columns. The first
column is shown in my form, the second one not because I made the
column wide 0cm. The second column is used to update a list which
shows a selection of names who are coresponding to several comboboxes.

I know you can use limit to list but limit lisst is already on Yes.
Because I use visual basic code to update a list with the following
code:

Sub Command6_Click()

Dim MySQL
Dim Prefix
Dim CountryCondition
Dim PriorityCondition
Dim BrancheCondition
Dim ExistingCondition
Dim ContactsYNCondition
Dim Postfix

Prefix = "SELECT Bank FROM [Data on bank level] WHERE "

If Me.ComboCountry <> "All" Then
CountryCondition = "[Country of interest] = '" &
Me.ComboCountry.Value & "' AND "
End If

If Me.ComboPriority.Value <> "All" Then
PriorityCondition = "[Contact priority] = '" &
Me.ComboPriority.Value & "' AND "
End If

If Me.ComboBranches.Value <> "All" Then
BrancheCondition = Me.ComboBranches & " AND "
End If

If Me.ComboExisting <> "All" Then
ExistingCondition = "[Existing Zurich Partner] = '" &
Me.ComboExisting & "' AND "
End If

If Me.ComboContactsYN.Value <> "All" Then
If Me.ComboContactsYN.Value = "Yes" Then
ContactsYNCondition = "[Data on bank level].[Bank] IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
If Me.ComboContactsYN.Value = "No" Then
ContactsYNCondition = "[Data on bank level].[Bank] NOT IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
End If

Postfix = "1=1 ORDER BY Bank;"

MySQL = Prefix & CountryCondition & PriorityCondition &
BrancheCondition & ExistingCondition & ContactsYNCondition & Postfix

Me.ListBank.RowSource = MySQL
Me.Refresh

End Sub

I get a runtime error 2227: the text you entered isn't an item in the
list at Me.Refresh.

Therefore I tried the following code in visual basic when I change the
combobox:

Private Sub ComboBranches_Change()

' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches] <
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list. Please
select an item from the list."
Exit Sub
End If

'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value

Call Command6_Click

End Sub

But this code does not work. When entering a value different from the
list in the combo box I do not get the error message. I entered a
watch and the watch tells me that the combobox has the previous
correct value. Does anyone know how to solve this problem?
 
S

SteveS

I am confused about what you are trying to do.

I rewrote your code to see if I could figure it out... I'm still lost. Maybe
the code will bel of some help to you.

If you set the variable "Debugging" to TRUE, it will print the string
variable strSQL to the immediate window (control-G).


' untested - watch for line wrap
'-------------------------------------------
Sub Command6_Click()

Dim strSQL As String
Dim Condition As String
Dim Debugging As Boolean

'set the following to TRUE to see the SQL
' for the list box row source in the
'immediate window
Debugging = False

strSQL = "SELECT Bank FROM [Data on bank level] WHERE"

If Me.ComboCountry <> "All" Then
strSQL = strSQL & " [Country of interest] = '" & Me.ComboCountry & "'
AND"
End If

If Me.ComboPriority <> "All" Then
strSQL = strSQL & " [Contact priority] = '" & Me.ComboPriority & "' AND"
End If

If Me.ComboBranches <> "All" Then
strSQL = strSQL & " " & Me.ComboBranches & " AND"
End If

If Me.ComboExisting <> "All" Then
strSQL = strSQL & " [Existing Zurich Partner] = '" & Me.ComboExisting
& "' AND"
End If

If Me.ComboContactsYN <> "All" Then
If Me.ComboContactsYN = "Yes" Then
Condition = "IN"
Else
Condition = "NOT IN"
End If

strSQL = strSQL & " [Data on bank level].[Bank] " & Condition
strSQL = strSQL & " (SELECT DISTINCT [Data on contact level].[Bank] "
strSQL = strSQL & " FROM [Data on contact level] "
strSQL = strSQL & " WHERE [Data on contact level].[Last Name] IS NOT
NULL) AND"
End If

'remove the last " AND" ...4 chars
strSQL = Left(strSQL, Len(strSQL) - 4)

'add Order clause
strSQL = strSQL & " ORDER BY Bank;"

'see top of code about debugging
If Debugging Then
Debug.Print strSQL
Stop
Else
'set list box rowsource
Me.ListBank.RowSource = strSQL
Me.Refresh
End If

End Sub
'-----------------------------------------------


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


jonneke said:
I would like to limit my combobox.

My combobox is called ComboBranches and has 2 columns. The first
column is shown in my form, the second one not because I made the
column wide 0cm. The second column is used to update a list which
shows a selection of names who are coresponding to several comboboxes.

I know you can use limit to list but limit lisst is already on Yes.
Because I use visual basic code to update a list with the following
code:

Sub Command6_Click()

Dim MySQL
Dim Prefix
Dim CountryCondition
Dim PriorityCondition
Dim BrancheCondition
Dim ExistingCondition
Dim ContactsYNCondition
Dim Postfix

Prefix = "SELECT Bank FROM [Data on bank level] WHERE "

If Me.ComboCountry <> "All" Then
CountryCondition = "[Country of interest] = '" &
Me.ComboCountry.Value & "' AND "
End If

If Me.ComboPriority.Value <> "All" Then
PriorityCondition = "[Contact priority] = '" &
Me.ComboPriority.Value & "' AND "
End If

If Me.ComboBranches.Value <> "All" Then
BrancheCondition = Me.ComboBranches & " AND "
End If

If Me.ComboExisting <> "All" Then
ExistingCondition = "[Existing Zurich Partner] = '" &
Me.ComboExisting & "' AND "
End If

If Me.ComboContactsYN.Value <> "All" Then
If Me.ComboContactsYN.Value = "Yes" Then
ContactsYNCondition = "[Data on bank level].[Bank] IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
If Me.ComboContactsYN.Value = "No" Then
ContactsYNCondition = "[Data on bank level].[Bank] NOT IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
End If

Postfix = "1=1 ORDER BY Bank;"

MySQL = Prefix & CountryCondition & PriorityCondition &
BrancheCondition & ExistingCondition & ContactsYNCondition & Postfix

Me.ListBank.RowSource = MySQL
Me.Refresh

End Sub

I get a runtime error 2227: the text you entered isn't an item in the
list at Me.Refresh.

Therefore I tried the following code in visual basic when I change the
combobox:

Private Sub ComboBranches_Change()

' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches] <
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list. Please
select an item from the list."
Exit Sub
End If

'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value

Call Command6_Click

End Sub

But this code does not work. When entering a value different from the
list in the combo box I do not get the error message. I entered a
watch and the watch tells me that the combobox has the previous
correct value. Does anyone know how to solve this problem?
 
J

jonneke

I am confused about what you are trying to do.

I rewrote your code to see if I could figure it out... I'm still lost. Maybe
the code will bel of some help to you.

If you set the variable "Debugging" to TRUE, it will print the string
variable strSQL to the immediate window (control-G).

' untested - watch for line wrap
'-------------------------------------------
Sub Command6_Click()

Dim strSQL As String
Dim Condition As String
Dim Debugging As Boolean

'set the following to TRUE to see the SQL
' for the list box row source in the
'immediate window
Debugging = False

strSQL = "SELECT Bank FROM [Data on bank level] WHERE"

If Me.ComboCountry <> "All" Then
strSQL = strSQL & " [Country of interest] = '" & Me.ComboCountry & "'
AND"
End If

If Me.ComboPriority <> "All" Then
strSQL = strSQL & " [Contact priority] = '" & Me.ComboPriority & "' AND"
End If

If Me.ComboBranches <> "All" Then
strSQL = strSQL & " " & Me.ComboBranches & " AND"
End If

If Me.ComboExisting <> "All" Then
strSQL = strSQL & " [Existing Zurich Partner] = '" & Me.ComboExisting
& "' AND"
End If

If Me.ComboContactsYN <> "All" Then
If Me.ComboContactsYN = "Yes" Then
Condition = "IN"
Else
Condition = "NOT IN"
End If

strSQL = strSQL & " [Data on bank level].[Bank] " & Condition
strSQL = strSQL & " (SELECT DISTINCT [Data on contact level].[Bank] "
strSQL = strSQL & " FROM [Data on contact level] "
strSQL = strSQL & " WHERE [Data on contact level].[Last Name] IS NOT
NULL) AND"
End If

'remove the last " AND" ...4 chars
strSQL = Left(strSQL, Len(strSQL) - 4)

'add Order clause
strSQL = strSQL & " ORDER BY Bank;"

'see top of code about debugging
If Debugging Then
Debug.Print strSQL
Stop
Else
'set list box rowsource
Me.ListBank.RowSource = strSQL
Me.Refresh
End If

End Sub
'-----------------------------------------------

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)



jonneke said:
I would like to limit my combobox.
My combobox is called ComboBranches and has 2 columns. The first
column is shown in my form, the second one not because I made the
column wide 0cm. The second column is used to update a list which
shows a selection of names who are coresponding to several comboboxes.
I know you can use limit to list but limit lisst is already on Yes.
Because I use visual basic code to update a list with the following
code:
Sub Command6_Click()
Dim MySQL
Dim Prefix
Dim CountryCondition
Dim PriorityCondition
Dim BrancheCondition
Dim ExistingCondition
Dim ContactsYNCondition
Dim Postfix
Prefix = "SELECT Bank FROM [Data on bank level] WHERE "
If Me.ComboCountry <> "All" Then
CountryCondition = "[Country of interest] = '" &
Me.ComboCountry.Value & "' AND "
End If
If Me.ComboPriority.Value <> "All" Then
PriorityCondition = "[Contact priority] = '" &
Me.ComboPriority.Value & "' AND "
End If
If Me.ComboBranches.Value <> "All" Then
BrancheCondition = Me.ComboBranches & " AND "
End If
If Me.ComboExisting <> "All" Then
ExistingCondition = "[Existing Zurich Partner] = '" &
Me.ComboExisting & "' AND "
End If
If Me.ComboContactsYN.Value <> "All" Then
If Me.ComboContactsYN.Value = "Yes" Then
ContactsYNCondition = "[Data on bank level].[Bank] IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
If Me.ComboContactsYN.Value = "No" Then
ContactsYNCondition = "[Data on bank level].[Bank] NOT IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
End If
Postfix = "1=1 ORDER BY Bank;"
MySQL = Prefix & CountryCondition & PriorityCondition &
BrancheCondition & ExistingCondition & ContactsYNCondition & Postfix
Me.ListBank.RowSource = MySQL
Me.Refresh
I get a runtime error 2227: the text you entered isn't an item in the
list at Me.Refresh.
Therefore I tried the following code in visual basic when I change the
combobox:
Private Sub ComboBranches_Change()
' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches] <
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list. Please
select an item from the list."
Exit Sub
End If
'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value
Call Command6_Click
But this code does not work. When entering a value different from the
list in the combo box I do not get the error message. I entered a
watch and the watch tells me that the combobox has the previous
correct value. Does anyone know how to solve this problem?- Hide quoted text -

- Show quoted text -

Thank you for looking at my script. Let me try to explain better.

I am trying to limit my combobox to specified values. I do not want
users to type in values that are not shown in the combobox. When they
do type in 'own' values I would like to give a msgbox that tells them
to select an item from the list. I tried to make this happen in the
second part of the script I submitted.
I know I can set the property limit tot list to yes but this does not
work becaus of the fact that I use the first part of my script. When I
use limit to list I get a debug error. Therefore I tried to make a
work around in the second part of my script.

The first part of my script you looked at is not that important. That
part works.

The second part of the script does not work. Whenever I type my 'own'
value in the combobox (not selected from list) I do not get the
msgbox.
Here the second part of my script:

Private Sub ComboBranches_Change()


' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches]
<
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list.
Please
select an item from the list."
Exit Sub
End If


'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value


Call Command6_Click


End Sub
 
S

SteveS

You don't need to have ".Value" after Me.ComboBranches because Vale is the
default property. It doesn't hurt, but it is more typing...

The reason the code doesn't give you the message box is because you are
checking *before* the new value is saved in the combo box. So you have to use
the TEXT property. Try this:

'------------------
Private Sub ComboBranches_Change()

If (Me.ComboBranches.Text <> "All" And _
Me.ComboBranches.Text <> "[Branches] >= 0 AND [Branches] < 10" And _
Me.ComboBranches.Text <> "[Branches] >= 10 AND [Branches] < 100" And _
Me.ComboBranches.Text <> "[Branches] >= 100 AND [Branches] < 250" And _
Me.ComboBranches.Text <> "[Branches] >= 250 AND [Branches] < 1000" And _
Me.ComboBranches.Text <> "[Branches] >= 1000 AND [Branches] < 2000" And _
Me.ComboBranches.Text <> "[Branches] >= 2000" And _
Me.ComboBranches.Text <> "[Branches] IS NULL") Then

MsgBox "The text you entered isn't an item in the list. Please select an
item from the list."
Exit Sub
End If


'store chosen selection
Forms!vars!Branches = Me.ComboBranches.value

End Sub
'----------------------------

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


jonneke said:
I am confused about what you are trying to do.

I rewrote your code to see if I could figure it out... I'm still lost. Maybe
the code will bel of some help to you.

If you set the variable "Debugging" to TRUE, it will print the string
variable strSQL to the immediate window (control-G).

' untested - watch for line wrap
'-------------------------------------------
Sub Command6_Click()

Dim strSQL As String
Dim Condition As String
Dim Debugging As Boolean

'set the following to TRUE to see the SQL
' for the list box row source in the
'immediate window
Debugging = False

strSQL = "SELECT Bank FROM [Data on bank level] WHERE"

If Me.ComboCountry <> "All" Then
strSQL = strSQL & " [Country of interest] = '" & Me.ComboCountry & "'
AND"
End If

If Me.ComboPriority <> "All" Then
strSQL = strSQL & " [Contact priority] = '" & Me.ComboPriority & "' AND"
End If

If Me.ComboBranches <> "All" Then
strSQL = strSQL & " " & Me.ComboBranches & " AND"
End If

If Me.ComboExisting <> "All" Then
strSQL = strSQL & " [Existing Zurich Partner] = '" & Me.ComboExisting
& "' AND"
End If

If Me.ComboContactsYN <> "All" Then
If Me.ComboContactsYN = "Yes" Then
Condition = "IN"
Else
Condition = "NOT IN"
End If

strSQL = strSQL & " [Data on bank level].[Bank] " & Condition
strSQL = strSQL & " (SELECT DISTINCT [Data on contact level].[Bank] "
strSQL = strSQL & " FROM [Data on contact level] "
strSQL = strSQL & " WHERE [Data on contact level].[Last Name] IS NOT
NULL) AND"
End If

'remove the last " AND" ...4 chars
strSQL = Left(strSQL, Len(strSQL) - 4)

'add Order clause
strSQL = strSQL & " ORDER BY Bank;"

'see top of code about debugging
If Debugging Then
Debug.Print strSQL
Stop
Else
'set list box rowsource
Me.ListBank.RowSource = strSQL
Me.Refresh
End If

End Sub
'-----------------------------------------------

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)



jonneke said:
I would like to limit my combobox.
My combobox is called ComboBranches and has 2 columns. The first
column is shown in my form, the second one not because I made the
column wide 0cm. The second column is used to update a list which
shows a selection of names who are coresponding to several comboboxes.
I know you can use limit to list but limit lisst is already on Yes.
Because I use visual basic code to update a list with the following
code:
Sub Command6_Click()
Dim MySQL
Dim Prefix
Dim CountryCondition
Dim PriorityCondition
Dim BrancheCondition
Dim ExistingCondition
Dim ContactsYNCondition
Dim Postfix
Prefix = "SELECT Bank FROM [Data on bank level] WHERE "
If Me.ComboCountry <> "All" Then
CountryCondition = "[Country of interest] = '" &
Me.ComboCountry.Value & "' AND "
End If
If Me.ComboPriority.Value <> "All" Then
PriorityCondition = "[Contact priority] = '" &
Me.ComboPriority.Value & "' AND "
End If
If Me.ComboBranches.Value <> "All" Then
BrancheCondition = Me.ComboBranches & " AND "
End If
If Me.ComboExisting <> "All" Then
ExistingCondition = "[Existing Zurich Partner] = '" &
Me.ComboExisting & "' AND "
End If
If Me.ComboContactsYN.Value <> "All" Then
If Me.ComboContactsYN.Value = "Yes" Then
ContactsYNCondition = "[Data on bank level].[Bank] IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
If Me.ComboContactsYN.Value = "No" Then
ContactsYNCondition = "[Data on bank level].[Bank] NOT IN
(SELECT DISTINCT [Data on contact level].[Bank] FROM [Data on contact
level] WHERE [Data on contact level].[Last Name] IS NOT NULL) AND "
End If
End If
Postfix = "1=1 ORDER BY Bank;"
MySQL = Prefix & CountryCondition & PriorityCondition &
BrancheCondition & ExistingCondition & ContactsYNCondition & Postfix
Me.ListBank.RowSource = MySQL
Me.Refresh
I get a runtime error 2227: the text you entered isn't an item in the
list at Me.Refresh.
Therefore I tried the following code in visual basic when I change the
combobox:
Private Sub ComboBranches_Change()
' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches] <
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list. Please
select an item from the list."
Exit Sub
End If
'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value
Call Command6_Click
But this code does not work. When entering a value different from the
list in the combo box I do not get the error message. I entered a
watch and the watch tells me that the combobox has the previous
correct value. Does anyone know how to solve this problem?- Hide quoted text -

- Show quoted text -

Thank you for looking at my script. Let me try to explain better.

I am trying to limit my combobox to specified values. I do not want
users to type in values that are not shown in the combobox. When they
do type in 'own' values I would like to give a msgbox that tells them
to select an item from the list. I tried to make this happen in the
second part of the script I submitted.
I know I can set the property limit tot list to yes but this does not
work becaus of the fact that I use the first part of my script. When I
use limit to list I get a debug error. Therefore I tried to make a
work around in the second part of my script.

The first part of my script you looked at is not that important. That
part works.

The second part of the script does not work. Whenever I type my 'own'
value in the combobox (not selected from list) I do not get the
msgbox.
Here the second part of my script:

Private Sub ComboBranches_Change()


' Does not work
If (Me.ComboBranches.Value <> "All" And _
Me.ComboBranches.Value <> "[Branches] >= 0 AND [Branches] <
10" And _
Me.ComboBranches.Value <> "[Branches] >= 10 AND [Branches] <
100" And _
Me.ComboBranches.Value <> "[Branches] >= 100 AND [Branches] <
250" And _
Me.ComboBranches.Value <> "[Branches] >= 250 AND [Branches] <
1000" And _
Me.ComboBranches.Value <> "[Branches] >= 1000 AND [Branches]
<
2000" And _
Me.ComboBranches.Value <> "[Branches] >= 2000" And
Me.ComboBranches.Value <> "[Branches] IS NULL") Then
MsgBox "The text you entered isn't an item in the list.
Please
select an item from the list."
Exit Sub
End If


'store chosen selection
Forms!vars!Branches = Me.ComboBranches.Value


Call Command6_Click


End Sub
 
J

jonneke

Unfortunately this is not working.
At first I thought it was, but when selecting a value from my list I
also get the error message.

Hopefully you will have an other suggestion.
Still think the problem is that I entered 2 columns. First visible,
second not. Does not recognise second value.
 
J

jonneke

Found it out myself.
Thanks to your hint!!!!!

The correct script is:

If (Me.ComboBranches.Text <> "All" And _
Me.ComboBranches.Text <> "< 10" And _
Me.ComboBranches.Text <> "10 - 100" And _
etc.

I should name the values of the first column in my combo box (which is
the visible column) in stead of the invisible second column.

Many Thanks!!!!!!!
 

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

Top