Me. VB Coding

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

Guest

If you are trying to referrernce something in another subform, for the record
you are on, like if it was in the main form, this would work.

Me.TxtFieldControlName = +1

But if there is a field in a subform that is in your main form and you want
to do that as well, to the current record open, what do you do?

Me. or Me!? Can't find any help that explains the ME expression, what it
can do, etc...

Thanks
Curtis
 
Curtis

You need to refer to the control on the subform, something like:

Me!SubformControlName.Form!ControlNameOnSubform

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
If you are trying to referrernce something in another subform, for the record
you are on, like if it was in the main form, this would work.

Me.TxtFieldControlName = +1

But if there is a field in a subform that is in your main form and you want
to do that as well, to the current record open, what do you do?

Me. or Me!? Can't find any help that explains the ME expression, what it
can do, etc...

Thanks
Curtis

See:
http://www.mvps.org/access/forms/frm0031.htm
 
You need to refer to the control on the subform, something like:
Me!SubformControlName.Form!ControlNameOnSubform

Not working...

Main form name is Potential. On this form, have two subforms named
MerchantInfoSubForm - point to separate table
LocationInfoSubForm - point to separate table

I have a command button in MerchantInfoSubform that I want to click and it
will take the info from the data in the location subform and paste it into
the approperiate fields in the merchant subform.

Here is the coding I have, I tried both versions:

Private Sub CmdAddrCopy_Click()
Me!LocationInfoSubForm.Form!BizLocalAddr =
Me!MerchantInfoSubForm.Form!MerchantStreetAddr
End Sub
==============================
Private Sub CmdAddrCopy_Click()
Me!LocationInfoSubForm.Form!BizLocalAddr = Me.MerchantStreetAddr
End Sub
 
Curtis,

Use a combination of the Parent and Form properties in specifying controls
on subform:

Control Specifier
---------------------------------------------------------------
Main Form Control Me.Parent![ControlName]
From Subform

Subform Control Me![Subform].Form![ControlName]
From Main Form

Subform Control Me.Parent![Subform].Form![ControlName]
From Another Subform

So, in your case, use the last example:

' Assign control value from LocationInfoSubform to control on
MerchantInfoSubform
' Code executed from command button on MerchantInfoSubform
Me![ControlName] = Me.Parent![LocationInfoSubform].Form![ControlName]

Hope that helps.
Sprinks
 
Oh, man I so needed this info long time ago, I think this will help a lot
with some of the things I'm trying to accomplish. Thank you so much, it's
apparent why you are Silver status!

Curtis

Use a combination of the Parent and Form properties in specifying controls
on subform:

Control Specifier
---------------------------------------------------------------
Main Form Control Me.Parent![ControlName]
From Subform

Subform Control Me![Subform].Form![ControlName]
From Main Form

Subform Control Me.Parent![Subform].Form![ControlName]
From Another Subform

So, in your case, use the last example:

' Assign control value from LocationInfoSubform to control on
MerchantInfoSubform
' Code executed from command button on MerchantInfoSubform
Me![ControlName] = Me.Parent![LocationInfoSubform].Form![ControlName]

Hope that helps.
Sprinks

Curtis Stevens said:
Not working...

Main form name is Potential. On this form, have two subforms named
MerchantInfoSubForm - point to separate table
LocationInfoSubForm - point to separate table

I have a command button in MerchantInfoSubform that I want to click and it
will take the info from the data in the location subform and paste it into
the approperiate fields in the merchant subform.

Here is the coding I have, I tried both versions:

Private Sub CmdAddrCopy_Click()
Me!LocationInfoSubForm.Form!BizLocalAddr =
Me!MerchantInfoSubForm.Form!MerchantStreetAddr
End Sub
==============================
Private Sub CmdAddrCopy_Click()
Me!LocationInfoSubForm.Form!BizLocalAddr = Me.MerchantStreetAddr
End Sub
 
Sorry, I hadn't caught that you were trying to copy from one subform to
another. It sounded like you were working between main form and subform.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
No prob, thanks for your effort too!

Sorry, I hadn't caught that you were trying to copy from one subform to
another. It sounded like you were working between main form and subform.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top