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

close form,open another, reopen first form to previously edited record 1

Status
Not open for further replies.

futbolista

IS-IT--Management
Jul 6, 2001
6
US
I have a form that contains contacts. On that form is a combo box that displays companies, that is populated with a lookup from the company table. The bound column is the primary key for the company table. When a user selects a company, the bound column value is saved to the foreign key in the contacts table, thus creating a one-to-many relationship. (One company has many employees) In order for a new company to appear in the combo box after it is added to the company table, a requery must be done of the contact form. This event sets the form back to the first record, thus losing the users "place" (the new record that was being added). Microsoft suggest a long, painful pair of procedures using DAO; I tried to set a global variable to a the ID field of the current record(Me![ID]), then use it in the LinkCriteria, but this approach proceeded to generate a variety of errors. Any suggestions?
 
You can requery the combo box only rather than the whole form and your new company will show up.

Me.MyComboName.Requery

I do this all the time, without the painful DAO stuff you're talking about.

HTH Joe Miller
joe.miller@flotech.net
 
I have used that method to requery combo boxes. But I just realized that the problem combo box in question is in an "Orders" form populated by a query as opposed to a table lookup, thus the complication. I am trying to allow the user to enter first then last name ( a composite field, [fname]&" "&[lname]) to check for existence; the remaining columns pull the company information from the company table.I receive errors when I try to requery the query that populates the combo box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top