Updating sub forms in MS Access

I had a request to do a simple update to a MS Access subform which should be easy enough but it can be tricky for new users to VBA to get the syntax correct.  The subform needed to be refreshed to ensure it has the current records, and then the number of records to be put on the label for the subform.  Here is my solution –

Form.frmSubForm.Form.Requery
Me.frmSubForm_Label.Caption = Me.frmSubForm.Form.RecordsetClone.RecordCount & " Records"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s