Full Version: VBA To Refer To A Tabed Field From A Subform
UtterAccess Forums > Microsoft® Access > Access Forms
suzukyoto
I have a field named "itemcode" which is on a tab control named TabCtl13 in my "main" form.
I also have a subform named "SALESDETAILSQRYSUB"

what i want to do is when i click in a field within "SALESDETAILSQRYSUB" subform to transfer the content of the specific field in "itemcode" in the main form

thanks
theDBguy
You could try:

Me.Parent.ItemCode = Me.FieldName

Hope it helps...
suzukyoto
frown.gif nope does not work
theDBguy
What exactly did you use and where did you use it? What exactly does "not work" mean? Did you get an error message?
suzukyoto
i get compile error

here is what i used:

Me.SALES.ITEMCODE = Me.ITEMCODE

sales=main form
itemcode is the field in the main form

"me.itemcode" is the name of the field within my subform which is called "SALESDETAILSQRYSUB"
theDBguy
Hi,

Assuming you're using this code within the subform, try replacing it with the following:

Me.Parent.ITEMCODE = Me.ITEMCODE
suzukyoto
yes that's what i wanted.
thanks for your help smile.gif
theDBguy
You're welcome. Glad to hear you got it to work. Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.