Refreshing subforms

  • Thread starter jubiiab via AccessMonster.com
  • Start date
J

jubiiab via AccessMonster.com

Hi

Below you can see the code of a refresh button I have on my form. The code is
working great but I just have one problem. On my main form I have 5 subforms.
When I press the refresh button, my subforms are not refreshing. Can I
somehow put some code in the below code so my subforms are also refreshed
when I press the button?


Private Sub refresh_Click()
On Error GoTo Err_refresh_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Forms!frm_Machine!MachineNr.SetFocus

Dim RecUF As Long

RecUF = Me!MachineNr
Me.Requery
Me.Recordset.FindFirst "[MachineNr] = " & RecUF


Exit_refresh_Click:
Exit Sub

Err_refresh_Click:
MsgBox Err.Description
Resume Exit_refresh_Click

End Sub
 
J

jubiiab via AccessMonster.com

I am sorry. I just found out that the code is refreshing subforms. I added
this last week:

Forms!frm_Machine!MachineNr.SetFocus

..and it worked. The reason i thought it was not working was because I had a
wrong copy opend of my form....sorry :0( I dont think I can delete a thread
in this forum?


Hi

Below you can see the code of a refresh button I have on my form. The code is
working great but I just have one problem. On my main form I have 5 subforms.
When I press the refresh button, my subforms are not refreshing. Can I
somehow put some code in the below code so my subforms are also refreshed
when I press the button?

Private Sub refresh_Click()
On Error GoTo Err_refresh_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Forms!frm_Machine!MachineNr.SetFocus

Dim RecUF As Long

RecUF = Me!MachineNr
Me.Requery
Me.Recordset.FindFirst "[MachineNr] = " & RecUF

Exit_refresh_Click:
Exit Sub

Err_refresh_Click:
MsgBox Err.Description
Resume Exit_refresh_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top