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

Combo Box requery

Status
Not open for further replies.

Griff389

Technical User
Jun 27, 2003
82
0
0
GB
I have a form with about 6 tabs in it.

The "Items" tab has a sub form with a continuos form it which one department enters a list of items to be repaired. (Data goes into an "items" table)

Another department uses a "Parts Used" tab to enter a list of parts used in the repair. (Data goes into a "Parts" table.
I have a combo box on the Parts Used" tab which looks at a query on the items table and shows the item numbers for the current record. A kind of filter in the combobox I guess.

This works fine when you drop the list down the first time. If you have two entries in the Item form it shows the two items, as it should.
However when you change record and then drop the list down again, it still shows the list from the first record, and not the item numbers for the current record.
It's as if Access is caching the combo box list, and not rerunning the query.

This is what I have in my combo box source field
SELECT QryPartsReplacedLookup.ItemNo, QryPartsReplacedLookup.Description, QryPartsReplacedLookup.ReturnNo FROM QryPartsReplacedLookup WHERE (((QryPartsReplacedLookup.ReturnNo)=Forms![Returns Report]![Returns Detail].Form!ReturnNo));

How can I get round this? Some sort of a requery when the control gets focus perhaps??

Cheers

Griff
 
Griff,
I'm guessing that the "Parts Used" is dependent on the "Item" selected. If that's true then your requery needs to be done when you select a new "Item" so the requery runs during the ON Click event of the "Item".

The format is "Combo-box-name.requery".

 
Thanks for the reply.

I ended up adding "ItemRepaired.Requery" to the Gotfocus event on the 'ItemRepaired' combobox so that it requeries only when someone adds a part to the repair list.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top