General discussion

Locked

Access 2000

By ricks ·
I need to know how to link fields in a Access2000 form. I have a form and the fields contain drop down lists. Depending on what is selected from the drop down list in one field, i want this to affect what populates in another field on the form.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access 2000

by leaslynn In reply to Access 2000

Create a field that looks up data from another table in Design view
In Design view, open the table where you want to add the lookup field.

If the field you want to use as the foreign key for the Lookup field already exists, click in that field'srow. For example, if you have a Products table that has a SupplierID field already defined, and you want to change it to a Lookup field to display supplier names from your Suppliers table, click in the SupplierID field's row.
In the Data Type column, click the arrow and select Lookup Wizard.

Click the option that indicates you want the Lookup field to look up the values in a table or query.

Click Next and follow the directions in the remaining Lookup Wizard dialog boxes.
When you click the Finish button, Microsoft Access creates the Lookup field and sets certain field properties based on the choices you made in the wizard. Once you've created a Lookup list field, if you add the field to a form, Microsoft Access copies its definition into the form. The combo box or list box is created automatically for the form. However, if you change the definition of a Lookup or value list field in the table after adding it to a form, those changes will not be reflected in that form. To correct this, delete the field from the form and then add it again.
Note It is also possible to add a Lookup field to a table that displays values from the same table that contains the Lookup field. For example, in the Employees table of the Northwind sample database the ReportsTo field is a Lookup field that displays data from the FirstName and LastName fields by looking up the corresponding EmployeeID in the same table.

Collapse -

Access 2000

by ricks In reply to Access 2000

Poster rated this answer

Collapse -

Access 2000

by donq In reply to Access 2000

You have many options:

A combo box is populated by what is in its "Row Source" property. I always base an entire form on a single query so I can display (linked) information from many tables while entering data in one table. If my Combo box RowSource was fed by a query with a primary key value included in the form query as well its easy to make the form repopupate (or requery) whenever the user selects a new value in the combo box. Is that what you want?

p.sp: it that will work make sure fields you intend to edit receive focus and others don't (or they are locked).

Collapse -

Access 2000

by ricks In reply to Access 2000

Poster rated this answer

Collapse -

Access 2000

by SanKulPune In reply to Access 2000

Hello,

Let us assume that you have two combo boxes on the form, Combo1 & Combo2; and you want to populate Combo2 depending on what is selected in Combo1.

Let us also assume Combo1 has been populated (either manually or programmatically) with the values
"A"
"B"
"C"
"D"

Again, assume that when you select A in Combo1 you want Combo2 to be populated with

"A1"
"A2"
"A3"

Similarly for "B" & "C" & "D" respectively.

Here is what, I am sure, helps.

In the Click event-procedureof Combo1 (Private sub Combo1_Click()); type the following code:
'***** CODE STARTS
Select Case Combo1.SelText

Case "A"
Combo2.RowSource = "A1,A2,A3"
Case "B"
Combo2.RowSource = "B1,B2,B3" Case "C"
Combo2.RowSource = "C1,C2,C3"
Case "D"
Combo2.RowSource = "D1,D2,D3"

End Select
'***** CODE ENDS

Run the form and select a value from Combo1 and you will get what you want in Combo2.

Your feedback will be highly appreciated.

With regards,

SanganakSakha
Simple & Effective Solutions To Small Problems, No QuickFixes

Collapse -

Access 2000

by ricks In reply to Access 2000

Poster rated this answer

Collapse -

Access 2000

by ricks In reply to Access 2000

This question was closed by the author

Back to Software Forum
7 total posts (Page 1 of 1)  

Related Discussions

Software Forums