Subform Refresh

tuktuk

Well-known Member
Joined
Nov 13, 2006
Messages
856
I have a main form “Switchboard” with a cmd button that open another form, “Input”. Form “Input” data source is “tbl_Observation_List”…..so when I make an addition to from Input it adds “tbl_Observation_List”.

there is a qry called qry_TenRecent_Additions that pulls the recent 10 entries from the “tbl_Observation_List”…..so I’ve created a subform called “qry_TenRecent_Additions subform” and it is part of “Switchboard”.

The prob is that the when I open “Input” and make and entry (basically updating the main list for subform “qry_TenRecent_Additions subform” then close “Input”, putting focus on the “Switchboard” i am not seeing the new addtiont ot eh subform.

NOTE: If I close and reopen “Switchboard” then the newly added data is shown in the subform.

Here is my attempt to refresh Switchboard

Private Sub Form_Activate()
DoCmd.SetWarnings False
'DoCmd.RunSQL ("qry_TenRecent_Additions")
Me.[qry_TenRecent_Additions subform].Form.Refresh
DoCmd.SetWarnings True

Does it need to be on a different action?
Thanks
TukTuk
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
If I understand your issue, using requery instead of a refresh should do the trick. If it doesn't try adding docmd.requery instead of the Me.[qry_TenRecent_Additions subform].Form.Refresh.

HTH
 
Upvote 0
alright this one is killing me....i've tried the requery instead of refresh and the docmd...still no go.

here is the code for the on close for the form INPUT:

Private Sub cmd_Close_Input_Click()
On Error GoTo Err_cmd_Close_Input_Click

DoCmd.SetWarnings False
DoCmd.OpenQuery ("qry_TenRecent_Additions")
DoCmd.Close acQuery, "qry_TenRecent_Additions", acSaveYes
DoCmd.Close acForm, "Input"
DoCmd.SetWarnings True

Exit_cmd_Close_Input_Click:
Exit Sub

Err_cmd_Close_Input_Click:
MsgBox Err.Description
Resume Exit_cmd_Close_Input_Click

End Sub

so all im trying to do is refresh or requery the main form Switchboard subform with new addition.

i've tried the on current sub and the on activate sub...here is the code i tried
Private Sub Form_Activate()
DoCmd.SetWarnings False
Forms!Switchboard!cmd_Open_Input_Terry.SetFocus
Me.Requery
DoCmd.SetWarnings True
End Sub

this one is getting the best of me...since i know i am so close...thanks
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top