update subform with the action from another subform

rslaymaker

New member
Local time
Today, 15:01
Joined
Feb 23, 2009
Messages
3
I have seen some similar posts on this topic, but none of the solutions work for my situation

I have two sub-forms residing on one form. The idea, is for a command from sub-form 1 will add a record to the file used by sub-form 2, which I have working. But, although the information is now on the file, the display of that information is not working. What I want is for that same command to refresh the display of data on sub-form 2. I have tried requery, the problem seems to be that sub-form 1 does not recognize sub-form 2, as indicated in the error message.

Thanks for any assistance on this.
 
Perhaps this link can assist with the syntax. Post back here with the actual names of the SubFormControls if you need further assistance.
 
Thanks so much for the assistance... I tried a couple of those ideas but could not get them to work.

My main form is called frmBUILD and that form contains two subforms frmBUILD_sub1 and frmBUILD_sub2. On frmBUILD_sub1 I created a command call cmdADD. When that is envoked, a record is added to the file used in frmBUILD_sub2 (that works). As part of this command executed from frmBUILD_sub1 I would like to refresh frmBUILD_sub2 with the updated data.

Dim NewRec As Object
Dim TeamCardID As Integer

Set NewRec = CurrentDb.OpenRecordSet("TEAM")

NewRec.AddNew
NewRec!TeamCardID = Me![CARD]
NewRec.Update

'With NewRec
' .AddNew
'.update
'End With

NewRec.Close

Forms!frmBUILD_sub2.Requery
 
Only the MainForm is in the Forms collection so:
Forms.frmBUILD.frmBUILD_sub2.FORM.Requery
...should work as well as:
Me.Parent.frmBUILD_sub2.FORM.Requery
 
Thanks so much for your assistance.... that appears to be working perfect.
 

Users who are viewing this thread

Back
Top Bottom