How can I refresh a subform's recordsource?

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a subform displayed in continuous forms that I need to refresh from
the parent form.

I can refresh controls on a subform as:

Me.f_Note_sub.Form![cboNationID].Requery

But when I try to refresh a subform recordsource as

Me.f_Person_sub.Form!RecordSource.Requery

I get an error that Access does not recognize "RecordSource"

Can anyone help me with the syntax to refresh a subform's recordsource?
 
Try this code:

Dim MyControl As Control
Set MyControl = Forms!FormName!ControlName
MyControl.Requery

Replace FormName for your main form name and ControlName for the name
of the subform control on the main form.

Hope this helps.
 
Dave said:
I have a subform displayed in continuous forms that I need to refresh from
the parent form.

I can refresh controls on a subform as:

Me.f_Note_sub.Form![cboNationID].Requery

But when I try to refresh a subform recordsource as

Me.f_Person_sub.Form!RecordSource.Requery

I get an error that Access does not recognize "RecordSource"

The !RecordSource is inappropriate. Just use:

Me.f_Person_sub.Form.Requery
 
Thanks guys


Marshall Barton said:
Dave said:
I have a subform displayed in continuous forms that I need to refresh from
the parent form.

I can refresh controls on a subform as:

Me.f_Note_sub.Form![cboNationID].Requery

But when I try to refresh a subform recordsource as

Me.f_Person_sub.Form!RecordSource.Requery

I get an error that Access does not recognize "RecordSource"

The !RecordSource is inappropriate. Just use:

Me.f_Person_sub.Form.Requery
 
Back
Top