Refresh Subform query

T

Theresa

I have a main form containing 2 subforms on tabs. Both subforms are based on
the same query. When I input a new record in the subform on the first tab, I
need the query to refresh to fill in information on the 2nd tab. I have
tried using me.requery in the tab controls on change event but it is not
working. If I close the main form and reopen it, or go to design view and
back to form view it works. What am I doing wrong?
 
T

Theresa

I actually got this working. However, when the form requeries it takes me
back to the first record in the main form instead of staying on the record I
am working on. how can I have the query refresh without changing records.
 
K

Ken Snell [MVP]

You'll need to read and store in a local variable the value of the primary
key of the record on which the subform is focused prior to doing the
requery, then do the requery, then move the subform's Recordset to the
record whose primary key has that stored value. The code also should handle
the situation where the record with that primary key value no longer is in
the subform's recordset.

You'll need to give us details about your setup. Post the code that is
working for you, and tell us what the primary key field's name is in the
subform's query and what data type that field is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Update / Refresh as sub form 1
Refresh Subform 3
tabs in a form 1
Requery 1 subform from another. 13
Form refresh 1
Subform Refresh HELP!! 10
Action based on subform record count 1
Tabs on Tabs? 3

Top