• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 32
  • Last Modified:

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
0
João serras-pereira
Asked:
João serras-pereira
  • 5
  • 2
2 Solutions
 
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
 
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now