Subform updating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form called NewDataEntry which contains a subform called
ActivityNewPart. I would like to click a command button on the main form
which would then cause a field called Plan on the subform to have the value
0. The following is the code that I am using but I am receiving a 'Method or
Data Member not found' error.
Private Sub Command46_Click()
Forms!NewDataEntry!SubformControl.Form.ActivityNewPart.SetFocus
Me.ActivityNewPart.Plan.Value = 0
End Sub

Thanks for any help.
JoeP
 
No need to set focus to that control:

Private Sub Command46_Click()
Forms!NewDataEntry!SubformControl!ActivityNewPart.Value = 0
End Sub
 
Hi Jo

Set Value of Plan to 0

Private Sub ButtonName_Click()
Forms!NewDataEntry!ActivityNewPart.Form!Plan = 0
End Sub


Set focus to Plan then set value to 0

Private Sub ButtonName_Click()
Me.ActivityNewPart.SetFocus
Forms!NewDataEntry!ActivityNewPart.Form!Plan.SetFocus
Forms!NewDataEntry!ActivityNewPart.Form!Plan = 0
End Sub


Change ButtonName to what it is

Good luck
 
JoeP said:
I have a form called NewDataEntry which contains a
subform called ActivityNewPart. I would like to click
a command button on the main form which would then
cause a field called Plan on the subform to have
the value 0.

Ken and Wayne -- as the Command Button is on the main form, why would it be
needful to use the "Forms!Formname" address?

Wouldn't it be simpler, and equally effective, to use the following?

Me!ActivityNewPart.Form!Plan = 0

I'd also comment that, if the Form in the Subform Control is in continuous
forms view, the currently-selected Record's Path Control will be set to 0.

Larry Linson
Microsoft Access MVP
 
Larry Linson said:
Ken and Wayne -- as the Command Button is on the main form, why would it
be needful to use the "Forms!Formname" address?

Wouldn't it be simpler, and equally effective, to use the following?

Me!ActivityNewPart.Form!Plan = 0

Yes; I was just using the poster's syntax.
 
Back
Top