A family of Microsoft relational database management systems designed for ease of use.
Hello
You can use a DLookup function in the Control Source property of the County field in your form to automatically fill it with the corresponding county from the ZipCodeTbl table.
Here is an example of the DLookup function you can use:
=DLookup("County","ZipCodeTbl","Zip='" & ContactTbl.ZipCode & "'")
This DLookup function will look up the County field in the ZipCodeTbl table where the Zip field matches the ZipCode entered in the ContactTbl form.
You can enter this DLookup function in the Control Source property of the County field in the form.
To access the Control Source property, open your form in design view, select the County field, and then go to the Properties window. In the Properties window, look for the Control Source property and enter the DLookup function in the textbox.
Alternatively, you can also use a JOIN statement in your form's query, which is more efficient as it returns only the necessary data.
For example,
SELECT ContactTbl.ZipCode, ZipCodeTbl.County FROM ContactTbl JOIN ZipCodeTbl ON ContactTbl.ZipCode = ZipCodeTbl.Zip
This query will join the two tables on the ZipCode column and return the ZipCode, County columns from both tables.
The above SQL statement should be placed in the Record Source property of the Form
This way the form will automatically fill the County field with the corresponding county from the ZipCodeTbl table based on the ZipCode entered in the ContactTbl form.
I hope this information helps.
Regards,
Abdal