By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Lookup field created with VBA ?

P: n/a
Create Lookup field with Visual Basic

Can i create a lookup field on the fly? In my table Students i want to
create a loookup field
TeacherID that looks up teachers by their LastName. Otherwise i use
the Lookup wizard in the
table, then i connect with the table Teachers and then i hide the
teaccherid.
I want to create this lookup field without the help of the wizard.How
can i do it ?
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jim, are you really sure that you want to do this at the table field level?
In my experience, a control that hides the actual value stored in the table
does nothing useful, and serves only to confuse people about what is really
there.

If you must, you can use DAO to set the field's DisplayControl property. The
basic idea is:

fld.Properties.Append fld.CreateProperty("DisplayControl", dbInteger,
CInt(acComboBox))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jim Stacey" <og********@yahoo.com> wrote in message
news:9c**************************@posting.google.c om...
Create Lookup field with Visual Basic

Can i create a lookup field on the fly? In my table Students i want to
create a loookup field
TeacherID that looks up teachers by their LastName. Otherwise i use
the Lookup wizard in the
table, then i connect with the table Teachers and then i hide the
teaccherid.
I want to create this lookup field without the help of the wizard.How
can i do it ?

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.