field rowsources

N

nath

Hello

I am accessing an access database from excel and using a
table in the database tbl_candidates to populate the label
captions on a userform, this works great. However, i have
one field ethnicity that i would like to populate from a
table tbl_ethnicity, this i have done in the database, but
i need to know how to work out :

a) Whether a field has a value list attached as outlined
above

b) how to work out the rowsource itself

The code i have used is below

Private Sub UserForm_Activate()

Dim flag As Boolean

flag = False
fname = "Z:\Misc\unmatch.mdb"

Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkjet.OpenDatabase(fname, True)

sql = "Select * from [tbl_candidates];"

Set rst = dbs.OpenRecordset(sql)

For h = 0 To rst.Fields.Count - 1

fld_name = rst.Fields(h).Name
UserForm1("Label" & h).Caption = fld_name
flag = False

Next h


Can anyone help

TIA

Nathan
 
N

nath

-----Original Message-----
Hello

I am accessing an access database from excel and using a
table in the database tbl_candidates to populate the label
captions on a userform, this works great. However, i have
one field ethnicity that i would like to populate from a
table tbl_ethnicity, this i have done in the database, but
i need to know how to work out :

a) Whether a field has a value list attached as outlined
above

b) how to work out the rowsource itself

The code i have used is below

Private Sub UserForm_Activate()

Dim flag As Boolean

flag = False
fname = "Z:\Misc\unmatch.mdb"

Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkjet.OpenDatabase(fname, True)

sql = "Select * from [tbl_candidates];"

Set rst = dbs.OpenRecordset(sql)

For h = 0 To rst.Fields.Count - 1

fld_name = rst.Fields(h).Name
UserForm1("Label" & h).Caption = fld_name
flag = False

Next h


Can anyone help

TIA

Nathan
.
No Worries now, i have worked it out.

nath
 

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