Populate combo box with values not stored in a table?

battlecat

Registered User.
Local time
Yesterday, 17:12
Joined
Jun 29, 2004
Messages
11
Hi all,

I am brand new to these forums, pls forgive me if this thread is in the wrong place.

I have a combo box on a form that I want to fill with values when the form is opened, but the values are not stored in any table (and they change based on info in other tables, so it wouldn't be possible to create a lookup table).

I know that in plain VB you can insert items by typing

comboBoxName.Items.Insert(index, text)

but there doesn't seem to be this option in Access. Am I missing something simple?

I have read something about being able to set the Row Source Type of the combo box to a function, but I can't find any examples of how that function would populate the combo box.

I'd REALLY appreciate any help or advice anyone can offer!! I'm embarrassed to say that I'm nearing the end of my second day trying to figure this out!!!

Thanks so much...
 
If you know the values, you can set up the list from VBA code surrounding each value with apostrophies and a semi-colon between each:

Me.MyCombo.RowSourceType = "Value List"
Me.MyCombo.RowSource = "'Bob'; 'Mary'; 'Mike'; 'Steve'; 'Jim'"
 
Thanks so much RichO and Pat!!! I appreciate the help so much. I can finally move on from my little stumbling block :) Thanks a million!
 

Users who are viewing this thread

Back
Top Bottom