Add Item to List Box on Form Load Event

crhodus

Registered User.
Local time
Today, 06:35
Joined
Mar 16, 2001
Messages
257
I've got a list box on my form that is populated from data located in one of my tables. I would like to be able to add an additional item to this list box for the user to choose from whenever the form is first loaded.

This should be simple, but I am not very familiar with VBA. Can someone help?

Thanks!
 
Is the RowSource of the list box a table or query?

If it is then you can add this additional data to the table.

If it is not then you can add the item by appending the new data to the RowsSource Property of the List Box control. Seperate usine the ;. Make sure to add each column if more then one is needed.
 
The RowSource is a Table, but I do not want to add this record to the table for other reasons.

I could remove the table name from the RowSource and replace with this query:

"SELECT CountyName FROM tblCounty ORDER BY CountyName;"

Can you give me an example on how to append the data? I'm trying to insert the value " All Counties" into the list box, but not in tblCounty. Hope this makes sense.

Thanks!
 
Try this:

SELECT CountyName FROM tblCounty
UNION SELECT " All Counties" From tblCounty
ORDER BY CountyName;
 
Thanks for your help! This corrected the problem.
 

Users who are viewing this thread

Back
Top Bottom