• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

How do I repaint a subform from a vba module?

I have opened a form that contains a subform.  i would like the subform to repaint or refresh after a (lengthy) code has run and derived results to the driving back end table.  I have tried Forms![mysubform name].Repaint but I keep getting an error that the system cannot find the object.  I have checked spelling, etc.

Thanks.
0
keithedwardb
Asked:
keithedwardb
1 Solution
 
MacroShadowCommented:
You must use the name of the subform control, the syntax would be:
Forms![MainForm]![mysubform CONTROL Name].Form.Requery
0
 
IT Project MgrVBA/SQL developerCommented:
You could try setting the focus to the subform, and then using the Refresh or Requery command.

Refreshing records only updates the data that already exists in your datasheet or form. It does not reorder records, display new records, or remove deleted records and records that no longer meet specified criteria. To do that, you can requery the records.

If you have the main form open, you should be able to use something like this:

      Me.mySubformName.SetFocus
      Me.Refresh

Alternately:
      Me.mySubformName.SetFocus
      Me.Requery
0
 
keithedwardbAuthor Commented:
Sorry for the apparent delay.  I have not used the system in a while and did not know how to accept an answer. (until I logged in!). Your answer solved my problem.
Thankyou.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now