Requery another subform from a subform

Gkirkup

Registered User.
Local time
Today, 15:04
Joined
Mar 6, 2007
Messages
628
I have a continuous subform, and want to requery another subform to display related information each time a new row is selected. How would I do that?
In other words, both are subforms on a main form, and I want to requery one from the other.
Second quetion, how do I trigger the requery each time a new row is selected? Would I use 'On Current'?

Robert
 
I have a continuous subform, and want to requery another subform to display related information each time a new row is selected. How would I do that?
In other words, both are subforms on a main form, and I want to requery one from the other.
Second quetion, how do I trigger the requery each time a new row is selected? Would I use 'On Current'?

Robert

Robert,

Yes, you would use the On Current event in the first sub form to requery the linked sub form

The trick it to set he master link field in the second sub form to reference a field in the first sub form.

Second sub form control's poperty for Master/link field: [MyFirstSubFOrm].form.[txtControlName]
 
HTC: For some reason that does not work. I will try the 'On current' approach. How would I requery a subform from another subform, both on the main form?

Robert
 
HTC: For some reason that does not work. I will try the 'On current' approach. How would I requery a subform from another subform, both on the main form?

Robert

Robert,

I am sorry that I was not more clear. It takes both parts. When you use the first sub form's On current event to requery the second sub form, it owrk because you have set the master linking fields of the second sub form to reference a control on the first sub form.
 
HTC: OK, I understand. Could you tell me how to requery the second subform from the first subform? The language I am trying fails to work.
Thanks!

Robert
 
Evan:
Thanks. I tried the following code:

Parent![3 SPT inventory subform].Requery

I received an error message telling me that the field '3 SPT inventory subform' is not found. Perhaps I need to add something else? That is the correct subform name.

Robert
 
Open your parent form in edit mode and look at the subform's properties.
Click the other tab. The name you see there is the name you should be using to refer to the subform.

If you still can't get it to work try putting a breakpoint in some code on your SECOND subform, and type the following into the debug (immediate) window:

? me.name

This should give you the subform's name.

Evan
 
Evan: You hit the nail on the head! The subform name on the main form was different to the subform name itself. I fixed that, and it worked pefectly.
Thanks so much.

Robert
 

Users who are viewing this thread

Back
Top Bottom