Combobox HELP!!!!!!!!

jrmellis

Registered User.
Local time
Today, 03:34
Joined
Mar 21, 2002
Messages
30
Why does a selection from a combo box displays the first option in the box instead of the selected option. Correct calculations are however performed on the selected option. Here is the code.


If cboSite.Value <> "(ALL)" Then
With Me!cboCategory
.RowSource = "SELECT DISTINCT [Picture Gallery].SiteCode, " & _
"[Picture Gallery].Category FROM [Picture Gallery] " & _
"WHERE [Picture Gallery].SiteCode = '" & cboSite.Column(2) & "' " & _
"UNION SELECT ' ', '(ALL)' FROM [Picture Gallery] "

.ColumnCount = 2
.ColumnWidths = "0 in; 1 in"
.Requery
End With
 
Bound Column is 1
 
Last edited:
You problem sounds like something I have run into and it's something simple. I think.
How familiar are you w/ SQL? I take a fairly straight-forward approach, myself. The only advise I can give you now is to try the same query in Query Builder to see what you get.

I'm not sure what...
"UNION SELECT ' ', '(ALL)' FROM [Picture Gallery] "
in your SQL does for you, but it's not something I recognize and could be causing some problems. You already have all the records from your Picture Gallery table. Maybe, I missed that day in SQL class!

Sorry for not being of more help.
 
If there are only two columns in the combo, your .column(x) can't be > 1. Remember, the column index is a zero based array so column 1 is referenced as .column(0) and column 2 is referenced as .column(1).
 

Users who are viewing this thread

Back
Top Bottom