subform in ms/ccess does not display the correct query

On my app I need to tightly control the behaviour even for the user (it is a medical app) . So I do have a form and a subform and the subform is bound to a query which I open when I press a button.
This is (almost) working, but, when I change the record on the master form I would expect to run the query and have the query result correctly displayed on the subform.

I have checked the query and it displays the correct output (in the current test, a null record set).
But the subform that is displayed dos not change and is kept on the first master record. Whenever I change the master record, it never changes. What shall I do to refresh the subform ?

any help appreciated
João serras-pereiraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ares KurkluSoftware EngineerCommented:
Are you saying is when you change the main form the subform contents are not refreshed?
I would think that the subform should be related to the main form by some field like an id
like if the main form has a patientid and if the subform has a patient id as well then you should be able to create a link between those 2 fields,
i think this may solve the problem.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
João serras-pereiraAuthor Commented:
well ... That is my problem.
when I relate with the link field I am getting into a lot of trouble.
So I changed to this "manual" way; all I want noa is to force the refresh...
0
Ares KurkluSoftware EngineerCommented:
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

João serras-pereiraAuthor Commented:
Ok
I'll try
My code is:

        Me.frmExameLista.SourceObject = "frmExameLista"
        Me.frmExameLista.LinkChildFields = "frm_IDpaciente"
        Me.frmExameLista.LinkMasterFields = "frm_IDpaciente"
        Me.frmExameLista.Visible = True

on the "on Current" on the master form...

But maybe I am wrongdoing and it is on the "current"
0
João serras-pereiraAuthor Commented:
nope again

here is my code now:

            Set q02_exameDef = LifeLingerDB.QueryDefs("q02_exame")
            q02_exameDef.SQL = strSetSQL
            Set q02_exameSet = LifeLingerDB.OpenRecordset("tblExame", dbOpenSnapshot)
            frmExameLista.Requery


on the "on load" event, I do link child and master
on the button click, I have the above code...

the requery should work because frmExameLista depends on q02_exame... and q02_exam is alrigh!
0
João serras-pereiraAuthor Commented:
the above code os on the master form on a button..
0
João serras-pereiraAuthor Commented:
Found it
Thanks!
Repeated the code
            Me.frmExameLista.SourceObject = "frmExameLista"
            Me.frmExameLista.LinkChildFields = "frm_IDpaciente"
            Me.frmExameLista.LinkMasterFields = "frm_IDpaciente"
            Me.frmExameLista.Visible = True
            frmExameLista.Requery
on the buttons and it works
thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.