Requery a subform on a tab control

wrek

Registered User.
Local time
Today, 21:36
Joined
Jun 14, 2001
Messages
88
(I have seen posts on this before, but never a concrete solution...)

I've got a tab control running off my main form (frmStatusDCPs)...for simplicity, two tab pages, each with a subform on it:

The first tab, has a subform (frmStatusDCNs) which is linked directly to the main (master-child relationship).

The second tab's subform (frmStatusDocuments) is NOT linked to main -- but it's recordsource is a query through which i pass variables from the FIRST tab/subform.

Problem: I want to requery the second tab's subform when the record changes on the first tab.

I've tried requery for the tab's OnClick, the 2nd subform's OnActivate, the 1st subform's AfterUpdate...none respond

Forms!frmStatusDCPs!frmStatusDocuments.Requery

(But when i add a button on the main, requery on the OnClick using the line below, it works :confused: )

Me.frmStatusDocuments.Requery

any ideas?
 
may be this will help....

whatevent you use, after update or onclick on the tab, does not matter.

1. set focus to subform
Forms![frmPrimary]![frmPrimarySubform].setfocus=true
2. then requery
Forms![frmPrimary]![frmPrimarySubform].Requery

hope it helps.

Dianna Goldsberg
 
Thanks for the response Diana...but unfortunately that did not work,
(I tried referencing the form in three ways)

Forms!frmStatusDCPs!frmStatusDocuments.SetFocus = True
Forms!frmStatusDCPs!frmStatusDocuments.Requery

Me.frmStatusDocuments.SetFocus = True
Me.frmStatusDocuments.Requery

Forms![frmStatusDCPs]![frmStatusDocuments].SetFocus = True
Forms![frmStatusDCPs]![frmStatusDocuments].Requery

Also, the OnClick event for the tab, does not seem to be 'occuring' when i click the tab...i put a msgbox in there, and nothing popped up.... :(
 
Last edited:
at the risk of being annoying, i'm bumping this...

(but only because I'd imagine the answer is simple...so simple that even I can't get it)
 
Thanks a lot Rich, that worked...

For anyone with this problem in the future, I called the SaveRecord and Requery on the OnChange for the entire Tab Control, and not the individual Page's OnClick

(don't know the science behind it, but it just wasn't calling it )
 
Hi All,
I am afraid that the above does not work either:

DoCmd.RunCommand acCmdSaveRecord
Me.Requery

Because the requeries the whole form and subforms and then takes me to the 1st record in the dataset. I need the focus to say on the current record with the tabs being updated for that person that I am looking at.

Any other ideas please?
Thanks
Max
 

Users who are viewing this thread

Back
Top Bottom