Refreshing a Subform

music_al

Registered User.
Local time
Today, 12:35
Joined
Nov 23, 2007
Messages
200
Hi

I'm adding a record to a table and then I want to be able to see that record in the Datasheet form but its not there. I have to select the datasheet and then click refresh for it to appear. I've tried refresh and requery but nothing seems to work...

Code:
    Forms![frm_Tracker]![multifrm_Master_Staff_List]![dsfrm_Master_Staff_List].Form.SetFocus
    Forms![frm_Tracker]![multifrm_Master_Staff_List]![dsfrm_Master_Staff_List].Form.Refresh
    Forms![frm_Tracker]![multifrm_Master_Staff_List]![dsfrm_Master_Staff_List].Form.Requery

Any help would be appreciated.
 
did you use the BUILDER to make the path? This doesnt seem correct.
Usu its:
forms!MasterForm!subformName!form!listbox


ALWAYS use the builder to get it correct.
 
I didn't know there was a builder to build VBA code.

I switched round the Requery and Refresh statements and it seems to work.

But, it seems I have to set focus on the form in order to Requery it. Is this correct or is there a way of requerying the form without setting its focus ?
 
check if there is a Link Master/Child Fields on [dsfrm_Master_Staff_List] sub subform.
if it has, try moving [[multifrm_Master_Staff_List] subform to correct related record of sub subform.
 
There isn't a VBA builder.
Ranman was suggesting using the builder in the query design window.

The syntax for referring to controls in a subform is
Forms!FormName.SubformContainerName.Form.SubformControlName

However if doing this from the main form, use Me. syntax to simplify that
Me.SubformContainerName.Form.SubformControlName

You do indeed need to set the focus to the subform.
You don't normally need to refresh. Just requery.
 
For starters, Refresh and Requery are not interchangeable.
1. Requery - does what it says - runs the query from scratch. So new records will be included, deleted records will disappear. Updated records may or may not be included depending on if your query has selection criteria and if the criteria of the updated record matches the criteria.
2. Refresh - updates EXISTING records ONLY. No new records will appear. Records deleted by some other process will be flagged as #deleted# Records that don't match the selection criteria could remain visible.
 

Users who are viewing this thread

Back
Top Bottom