Updating data in a lookup list in a form

  • Thread starter Thread starter P Mitchell
  • Start date Start date
P

P Mitchell

Hello

I would like someone to be able to help with the updating of data in a
lookup list in a subform. In short, is their a VB instruction that is the
equivalent of performing the action of going to the menu and selecting
Records and then Refresh?

or

To explain, based on a three table system where cars participate in rallies,
which is a many to many relationship, between the Cars and Rallies tables,
which is resolved by having a Races table.

I have a menu/switchboard which contains a button that opens a
mainform/subform.

On the mainform/subform is a button to open a form to allow the entry of a
new car into the Cars table.

I realise this button could be placed on the Menu form, but for better or
worse, if it is placed on the Mainform/Subform

and one then uses the New Car form to enter the details of a new car

and one then returns to the Mainform/Subform the new car appears in the
lookup list (which is the foreign key field in the Races table, i.e.
[Races.Engine #]), but if one repeats this process a 2nd time (or more),
without closing the Mainform/Subform, the 2nd car does not appear in the
lookup list. Selecting Records and then Refresh from the menu system updates
the lookup list. But I have tried numerous instructions in VB when returning
to the form, but I cannot find an instruction that matches Records and then
Refresh. And where does one place the instruction? On Activate, On Got
Focus, or ?????

I have attached a zipped file containing a sample database.

Thank you in anticipation for any assistance.

Peter
 
After adding your new car(s) it should be as simple as requerying the
listbox ( or the source of the listbox). I think to make sure that it is
always updated correctly I would requery on got focus of the Main form.

HTH
Kat
 
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, 0,
acMenuVer70

OR

Me.refresh

this will refresh the data and should make it appear in
the list

Dan
 
Back
Top