Dilemna on Autofilling Form Fields by cross-querying other table

AlexanderX

New member
Local time
Today, 12:07
Joined
Mar 20, 2001
Messages
6
Hi all - I have an dilemna relating to autofilling form fields based on a combo-box selection.

I have a lengthy entry form used to enter new case details. There is a combo-box that is used to select one of 70 institutions; this combo-box writes the institution's ID number into an InstitutionID field in the master table (Main). InstitutionID, in turn, is linked to a second table (Institutions) containing all details relating to the institution (address, etc.).

Further down on this same form, there are three text boxes - one to enter the name of a current medical provider, one to enter a phone number, and one to enter a fax. There are times when the institution will be the same as the medical provider.

I'd like to set up this form so that when a user selects an Institution, the selected institution's name and phone/fax are copied into the medical provider fields

How I see this working is that the InstitutionID matching the user's institution selection would then be queried against the Institutions table's InstitutionID field. If a match is found, the name/phone/fax fields from the matching record are autofilled into the form's fields.

I assume this will require VB coding - I'm still very new to this area and am looking for any suggestions on how I can accomplish this goal.

The other option is that I can write hard-code in the form's Visual Basic modules that would explicitly spell out what contents should be written to the Current Provider name/phone fields when one of the 70 institutions are selected. I'd like to avoid this, however, due to the sheer number of code lines this will require.

Thanks in advance for any assistance you can give with this!
 
If you have the Solutions.mdb sample database, I think the EditProducts form has the example you're seeking.

If not, post again please!
 

Users who are viewing this thread

Back
Top Bottom