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

Combo Box

Status
Not open for further replies.

manjeetsimone

IS-IT--Management
Jun 17, 2001
5
AU
Hi

I have a table called A and it has two fields Town and code
Each town has only 1 code e.g : town - AA, code - 4001

I would like to know how can I link this two fields in my form. I have change both the fields to combo box, but when I choose town AA in my form the code does not change automatically.

Can some one please tell what i need to do so that each time I pick a town the corresponding code will appear in the code field in my form automatically.


 
Try using a DlookUp function in the AfterUpdate event of the Town Combo box and having the Code field as a text box.

Place this code in the AfterUpdate event of the Town combo box:

Me.Code.Value = DLookUP ("
Code:
","A","[Town] ='" & Me.Town & "'")

You could also set the Enabled property of the Code text box to False and the Locked property to True, this will make sure that you cannot change the value in this field without using the Town combo.

Hope it helps Jamie Gillespie
j-gillespie@s-cheshire.ac.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top