Link to home
Start Free TrialLog in
Avatar of João serras-pereira
João serras-pereiraFlag for Portugal

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Ares Kurklu
Ares Kurklu
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of João serras-pereira

ASKER

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...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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"
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!
the above code os on the master form on a button..
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