Requery Method

  • Thread starter Thread starter Vic Spainhower
  • Start date Start date
V

Vic Spainhower

Hello,

I have a form containing a tab control which has various subforms on each
separate tab. On one of the tabs the user can select a different back-end
database for these various subforms and it will delete all of the links and
re-attach the new database. It then does a requery on each subform but
nothing happens as the data is still from the original linked recordset.
When I close the form and then re-open it all of the subforms will reflect
the proper database. I'm doing the requery (
Forms!frmsetup!frmShow_Setup.Form.Requery) on the tab control change event
but I've also tried other events without success.

Can someone tell me why this won't work.


Thank you very much!

Vic
 
I am not sure from your naming convention but "frmShow_Setup" must be the
name of the Subform*Control* which can be different from the name of the
Form being used as the Subform (or more technically accurate, the name of
the Form being used as the SourceObject of the SubformControl).
 
Van,

frmShow_Setup is the name of one of the the subforms and it is the
underlying recordset that I am trying to requery.

Vic
 
OK.. that means you didn't use the Subform*Control*Names and that why the
statement won't work.

You need to check the names of the Subform*Controls* in the DesignView of
the main Form and use them in your statement(s) rather than the SourceObject
names. In the DesignView, simply select the Subform Control by clicking it
once then check the name in the Properties window.
 
Van,

This works:
Forms!frmSetup!frmShow_Setup.Form.RecordSource =
Forms!frmSetup!frmShow_Setup.Form.RecordSource
Forms!frmSetup!frmShow_Setup.Form.Requery

I added a pair of the above statements for each separate tab and the requery
now works. I'm not sure why I need to refresh the record source in this
situation but it did force Access to do the requery. I'm using Access 2002.

Vic
 
Back
Top