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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Validation

Status
Not open for further replies.

mondeoman

MIS
Dec 7, 2006
203
GB
I have an data input form where the user selects an "Employer" from a combo box cboEmployer that looks up a value in the table tblEmployers. This table has four fields - 1. EmployerID, 2. Employer 3. EmployerAddress 4. EmployerCode. The user then in the next combo box cboEmployerAddress selects the Employer's address derived from the same table tblEmployers. It is possible for the user to accidentally select the wrong address. What I want is for the form to check that the address relates to the correct employer and then throws up an error message if the wrong address is selected - ie. on selecting the address the form looks at the Employer's name and confirms that the address is good.

How can I do this please.
 
It is possible to limit the list in the second combo to hold only addresses that relate to the employer selected ( or if only one address is available per employer, to skip the second combo altogether and to update a textbox in the after update event of the first combo, if you wish it to be editable:

Code:
Me!SomeTextbox=Me.FirstCombo.Column(2)

Or simply set a textbox's Control Source to

Code:
=FirstCombo.Column(2)

If the information is available in the employer table, there is no need to store it again.

Numbering of columns starts from zero, so two, because address is the third column.

So, do you still wish to take the time to look up the table?



 
No I recognise now that I don't need to update the table as I can access the data which is already there. It was sort of the comfort factor of redundancy that kept me thinking that way. but clearly it makes sense to follow the normalisation rules. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top