OK..I am really out of my element here...but..
it is possible to build a dropdown list in which the choices are called out in the SQL statement? and what would that statement look like?
OK..I am really out of my element here...but..
it is possible to build a dropdown list in which the choices are called out in the SQL statement? and what would that statement look like?
Sure is. It's any valid Select Query. If the select query contains more than one column it uses the columns left to right depending on how many columns you set up your ComboBox/ListBox/ListView control to use. Columns exceeding the ComboBox.ColumnCount Property are just ignored. It's generally best to pull in only the column(s) you need though.
SELECT [MyTable].[MyField] FROM [MyTable] ORDER BY [MyField];
Cordially,
Aaron
Keep Our Board Clean!
- Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
Oorang..you missed, probably due to me not be clear, the real thrust of my question. I know it can be done that way...my question is with without having the choices in a table...but having them listed out in the actual SQL statement.
OIC AFAIK you can only "hard code" columns. You could try to pull something off with a crosstab, but remember aggregate only return numbers, so if your combobox is not numeric you're out of luck. Beside, that's asking to get shot by however has to maintain your code
There might be an alternative, what problem are you trying to solve?
Cordially,
Aaron
Keep Our Board Clean!
- Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
Do you mean the list exists as either a multi-select combo or listbox, then the choices are concatenated into an In("choice1",..."choice_n") or just a multiple WHERE...AND statement???Originally Posted by GoKats78