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

Requery subform from another form 1

Status
Not open for further replies.

RealKiwi

Technical User
Feb 26, 2004
41
NZ
I have a Order mainform/Order Details subform. In an Inventory form I have a button to add new items to the Order Details.

When each item is added I wanted to update the subform (Order Details) to show the new item.

Ive tried various combinations but keep getting this error:

>> Runtime error 2450: Cant find the form referred to in a macro or Vb code.

The really frustrating part is Ive used similar code on main/subform combos. Here's the lastest version that doesnt work:

>> Forms!fmOrderDetail.Form.Requery

also failed with:

>> Forms!fmOrderDetail.Requery
>> [fmOrderDetail]!Form.Requery
>> Forms!fmOrder.Form!fmOrderDetail.Requery

Is it possible to requery across independent forms, and if so how? Im fairly sure I have to refer to the Forms collection since the Order/Inventory and OrderDetail/Inventory forms are independent of each other.

cheers
 
Should be possible. Seems the only thing you haven't tried is:

[tt]Forms!fmOrder!fmOrderDetail.Form.Requery[/tt]

- note - the subformcontrol name must be used. This might differ from the name of the subform as viewed in the database window.

Roy-Vidar
 
Thanks Roy,
Your point about using the "control name" was the key. As you noted the control name given to my subform (subOrderDetail) was not the actual name I gave to the form object (fmOrderDetail) - a subtle but crucial difference!. Once I sprucced that up it worked like a charm.

>> Forms!fmOrder!subOrderDetail.Form.Requery

many thanks - frustration gone, relief seeping in...

ps. a star for a star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top