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

combo box "auto-populate" twist

Status
Not open for further replies.

StickMan

Technical User
Jan 2, 2001
30
US
I'm looking for way of "auto-populating" text boxes based on a combo box selection, but with a twist.

I have two forms (in Access 2000): frmCompany, frmContact. In frmContact, there is a combo box (cboCompanyID) that displays the Company ID (autonumber). After selecting a Company ID, other text boxes are "filled" in for: Company name, street, city, etc.

This is easy to do with the column.property or DLookUp.

What I want to be able to do is edit the text boxes after they have been "filled". The reason for this is that a lot of contacts will have the same address except for the addition of: Room xxx, Floor xxx, Bldg xxx, or whatever. (This usually occurs with government addresses). Another reason is to save on typing, since the information is already copied, all I have to do is add the extra info.

One idea is to use a checkbox that says "use same address as Company listing". yes means use the company address from tblCompany, or no, let the text box be editable and saveable to the table. I just don't know how to make a text box editable with an expression as the control source.

Another idea is to have an alternate address listing. A checkbox to show which address to use: the main or the alternate. But with the alternate, I still would like the address information to be copied to the alternate address text boxes.

Any tips, codes, redesign of the table relationship, or info on what to look for in help/VBA will be greatly appreciated.

Mike
 
I think you have it right with the redesign idea. You might consider having a separate addresses table and store the foreign key in your company and contacts table. This way once you have entered an address it is available for any company or contact. More important is that when the address changes you will only have to change it in one place and not chase all over your database hunting for all the records that need to be changed.

Then, all that's left is to put in your company and contacts table only those fields (like room) that might be different. "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top