By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

using requery on subform

P: n/a
Previously i had a combo box where i could select a name and then click
a button and a subform on that form would requery and give me the
information i wanted.
However, i have now changed the combo box to a list box...and am having
a difficult time integrating the requery feature.
in short i have

strWhere = "[memberID] = "
For Each varItem In Me.MemberID.ItemsSelected
strWhere = strWhere & Me.MemberID.ItemData(varItem) & " OR [memberID] =
"
Next varItem
strWhere = Left(strWhere, Len(strWhere) - 17)

i know how to write the next line if i was sending this info to a
report. however, i have not been able to figure out how to make a
command that will requery the subform.
i have tried docmd.requery "subfrmindividual",,strwhere
and i get errors.
can anyone help....please!
caleb

Aug 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
One way to do it would be to build your sql statement as a string variable
and then assign that to your subform's recordsource property.

form.subform.form.recordsource = sqlstring

Wes

<cm******@ufl.eduwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
Previously i had a combo box where i could select a name and then click
a button and a subform on that form would requery and give me the
information i wanted.
However, i have now changed the combo box to a list box...and am having
a difficult time integrating the requery feature.
in short i have

strWhere = "[memberID] = "
For Each varItem In Me.MemberID.ItemsSelected
strWhere = strWhere & Me.MemberID.ItemData(varItem) & " OR [memberID] =
"
Next varItem
strWhere = Left(strWhere, Len(strWhere) - 17)

i know how to write the next line if i was sending this info to a
report. however, i have not been able to figure out how to make a
command that will requery the subform.
i have tried docmd.requery "subfrmindividual",,strwhere
and i get errors.
can anyone help....please!
caleb

Aug 25 '06 #2

P: n/a
cm******@ufl.edu wrote:
i know how to write the next line if i was sending this info to a
report. however, i have not been able to figure out how to make a
command that will requery the subform.
i have tried docmd.requery "subfrmindividual",,strwhere
Another thing that might help is that when using subforms you can't
access the subform controls directly (or at least I haven't figured out
how). You have to go through the main form.

You may want to try something like:

docmd.requery Forms!frm_MainForm!subfrmindividual,,strwhere

Or even use a Filter instead:
Forms!frm_MainForm!subfrmindividual.Form.Filter = "..."
''Note: enter where criteria without the "where"

Cheers

Aug 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.