I'm getting lost here. What does "does not present the data
based on the new value" mean. Is there something going on
betond simply setting the subform's record source? Looking
at your other attempt (where you need additional quotes), I
think you're using the combo box(es?) to filter the
subform's data. If this whole thread is only about
requerying the subform, this sure is the long way around.
You can set the subform RecordSource to it's original query
with out having any idea what the query was:
Me.subForm.Form.RecordSource = Me.subForm.Form.RecordSource
But, even that is overkill to just get the subform's data
resynchronized with the new combo box value. The standard
line of code to do that is just:
Me.subForm.Form.Requery
--
Marsh
MVP [MS Access]
The subform works fine as a subform when I open the main form and navigate
through the records. The correct data is displayed just fine.
I am trying to get it to requery when I change the value of the combo box.
A previous post said it would requery if I set the record source. So that is
what I have been trying. In short, when I change the combo box value using
the recordsource statement setting it to the original query on "after
update", I lose the data that was in the subform and it does not present the
data based on the new value. The project is at work so I will try the quotes
tomorrow. Knowing more detail as to what I am trying to do, do you have any
other suggestions?
Marshall Barton said:
If the query works fine by itself or in the form not as a
subform, then the problem must be something in the main form
subform combination. The most likely culprit is the Link
Master/Child properties of the subform control. Double
check them to make sure they're what you want.
Karen53 wrote:
I tried this one too. It returns no values. If I run the subform
separately, it runs fine. I have double checked the name of the sub form
control and the names of the combo boxes.
Karen53 wrote:
How do I set a subform record source to a query?
I have tried this..
Me.subForm.Form.RecordSource = Query![qryName]
:
That should be:
Me.subForm.Form.RecordSource = "qryName"