Refresh Subform query

  • Thread starter Thread starter Theresa
  • Start date Start date
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?
 
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.
 
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.
 
Back
Top