How to requery/refresh data in a subform (1 Viewer)

BKMD

New member
Local time
Today, 20:27
Joined
Dec 20, 2010
Messages
3
Hello, I am reltatively new to this so seek guidance.

I have 3 forms, "FrmBack", "FrmList", and "FrmQTst".
"FrmBack" is unbound, "FrmList" is bound to table "TblAppDetails"
"FrmQTst" is bound to parameter query "QryTst" which is bound to two tables, "TblAppDetails" and "TblData".

I have made both "FrmList" and "FrmQtst" sub forms on "FrmBack"

The criteria of "QryTst" is set to = selected field value on the subform "FrmList"

What I would like to happen is the subform "FrmQTst" to display the data relevant to the record selected on the sub form "FrmList".

At the moment this works fine for the actual form FrmQTst, but how do I do the same for the sub form FrmQTst?

May be easy enough, but I just can't see it all.

:cool:

Ian
 

CBrighton

Surfing while working...
Local time
Today, 20:27
Joined
Nov 9, 2010
Messages
1,012
There's a few ways you can do this, here's a couple of ways which you can use VBA to do it.

Set the recordsource of the 2nd subform from the on current event of the 1st subform.

Or have the recordsource not have the criteria and have the same event set the .filter property of the 2nd subform.

Either will give the same result.

If you need a more in-depth explaination please provide the SQL behind the current recordsource of the 2nd subform (the one which is based on the other subform). With the SQL I can write the VBA, but I'll also need the name of the 2nd subform control (not the form which it contains) to do the full code.
 

BKMD

New member
Local time
Today, 20:27
Joined
Dec 20, 2010
Messages
3
Thanks for the info, sorry I took so long to reply. Here's what I ended up with.
I left everything as it was, then added to the "on click event" of the joined field in the first subform the following code.

Forms!FrmBack.FrmQTst.Form.Requery

Bingo, just what I was after.
:)
 

kegan

New member
Local time
Today, 12:27
Joined
Dec 9, 2011
Messages
2
HI, I am attempting to do the same linking of master to child and then requery so that it will update. I have 4 forms.

Tracker
Tracker Sub 1
Tracker Sub 2
Tracker sub 3

Down the hierarchy they all rely on the previous. so the relationships all lead from "Tracker" down to Tracker Sub 3, with each having tables accordingly.

I create a form wizard and can only get the 3 first forms on it. I then want to add a subform for Tracker sub 3, which will update when its predecessor Tracker Sub 2 Updates.

Questions:
Do I have the child and master fields done correctly?
What exactly do I put in the event section?
If anyone has a sample of a database which uses the 3 subforms, can they send me, so I may reverse engineer? Kegan.Longridge at Enbridge.com
 

Attachments

  • Overview.png
    Overview.png
    38.6 KB · Views: 1,549
  • Overview 2.png
    Overview 2.png
    75.8 KB · Views: 1,018
  • Overview 3.png
    Overview 3.png
    33.2 KB · Views: 930

BKMD

New member
Local time
Today, 20:27
Joined
Dec 20, 2010
Messages
3
Was just browsing then realised I hadn't given CBrighton a thumbs up thankyou for the reply. Have done so now, better late than never.
 

Users who are viewing this thread

Top Bottom