Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking text box to database

Status
Not open for further replies.

eussias

Programmer
Sep 25, 2001
97
0
0
AU
Hi,

I'm very new to VBA and have some questions which may be very basic so bear with me. I would like to link to contents of a text box to a specific database entry. Any help would be appreciated. Thanks.
 
If you could be more specific that might help... you might also try running one of the form wizards as it is almost always better to start there (create a new form and you should be given the option).

I am guessing you either want to set the text box's control source property equal to the field or you want to use DLookup to find it.

You can access a controls properties by right clicking it and selecting properties. Note there are multiple tabs to show either all or subsets of properties. On the All tab, Control Source should be first in the list. You should be able to drop down the list and select a field. If not you have not set the Recordsource of the form.

I hope this gets you pointed in the right direction.
 
Sorry for not being more specific. I have a List box that contains names from one column of a table. When an name is selected in the list box, I would like the text box next to this to display the date of birth for that person. DOB is also held in the table. Thanks for your help.
 
If the DOB is already in the listbox then have a look at the Column property of the ListBox object else you may consider the DLookUp function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

When the list box does have the DOB in another column then you could put this code in the control source of the text box.


=Forms!yourform!yourlistbox.column(1)

remember column count starts at 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top