Combobox HELP!!!!!!!! (1 Viewer)

jrmellis

Registered User.
Local time
Today, 12:19
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
 

jrmellis

Registered User.
Local time
Today, 12:19
Joined
Mar 21, 2002
Messages
30
Bound Column is 1
 
Last edited:

casey

Registered User.
Local time
Today, 12:19
Joined
Dec 5, 2000
Messages
448
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.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:19
Joined
Feb 19, 2002
Messages
43,707
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

Top Bottom