Inserting new values into a combo box

astarbyfar

Registered User.
Local time
Today, 21:16
Joined
Apr 27, 2003
Messages
93
Hi, I have a form which has a combo box on it whose rowsource is a table i.e. the source code of the combo box is

SELECT [LineTable].[Line number] FROM LineTable

This will give me all values already stored in the Line Table. However because I want to produce a query from the value stored here I need to insert the value ALL into the combo list.

However I cant manage to do it. I dont want to insert ALL into the Line Table because that will cause more problems. Likewise I dont want to manually type the values in myself because if the Line Table is updated this also means I will have to manually update the code.

Any ideas?
 
Rural guy Ive took note of the database that UncleGizmo posted on his website and typed the following

SELECT [Press Line Table].[Press Line] FROM [Press Line Table] UNION SELECt "*","<ALL>" FROM Press Line Table;

but I get an error saying Syntax error in FROM clause

I then tried to type

SELECT DISTINCT ROW [Press Line Table].[Press Line] FROM [Press Line Table] UNION SELECt "*","<ALL>" FROM Press Line Table;

which is in the example database and got the following error

Syntax error (missing operator) in query expression 'ROW [Press Line Table].[Press Line]'

Any ideas whats up with this?
 
First, remind that whenever using UNIONS, the number of columns for all statements much EXACTLY be the same...

Second, as you experienced, you should NOT use spaces in object names.
Change the name of your table to tblPressLine and change your column name to PressLine and use this as your rowsource :

Code:
SELECT tblPressLine.PressLine 
FROM tblPressLine 
UNION 
SELECT "<ALL>" 
FROM tblPressLine;

RV
 
Hi astarbyfar,
RV has the best answer. CamelFontNames or Under_Score_Names will not give you grief as you have experienced. If you haven't figured it out yet, using:
SELECT DISTINCT ROW [Press Line Table].[Press Line] FROM [Press Line Table] UNION SELECT "<ALL>" FROM [Press Line Table];

would have also corrected the errors you were getting but you should really change the names of things if it is not too late.
 

Users who are viewing this thread

Back
Top Bottom