Fill Combo Box With File Names

D

darryle

I would like to fill a combo box with table names. Can
someone give me a hint?

Thanks!
 
O

OriginalStealth

First Set your combo box format properties to the
following:

column count: 2
column widths: 0";1"

Next add this to your form's OnLoad Property.


Private Sub Form_Load()

'Declare variables
Dim db As Database
Dim tdf As TableDef

Set db = CurrentDb()

'Fill with Tables
For Each tdf In CurrentDb.TableDefs
Me.cbo1.AddItem "TABLE;" & tdf.Name
Next

End Sub
 
T

TC

Depends on version of Access.

For A2k?+, use the AddItem method (as per other respondent).

For A97 & before, check online help for the RowSourceType property - getting
listbox values from a function.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top