X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Update Control In One Subform From Another Subform, Access 2013    
post Jul 17 2019, 08:51 PM

Posts: 71
Joined: 12-March 04

What seemed to be a rather simple action has me completely bewildered!

I have a form (frmSponsors) with a Tab Control containing four subforms. Each subform is tied to the main with Master/Child IDs.

Now for the dilemma! I have a control on sfrmPKG called PkgID. I want an AfterUpdate Event on PkgID to update the control on sfrmWording (also PkgID) with the same value. No matter how I reference the 2nd subform, the VBA stops and tells me it can't find sfrmWording (the last attempt was: Me!sfrmWording.Form!PkgID = Me.PkgID).

Can someone shed some light, please?

Go to the top of the page
post Jul 17 2019, 09:13 PM

UA Admin
Posts: 35,681
Joined: 20-June 02
From: Newcastle, WA

The reference needs to be to the name of the subform CONTROL, which may or may not be the same as the name of the subform in that control. Make sure that is how your reference is written.

My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
post Jul 18 2019, 05:50 AM

Posts: 160
Joined: 28-March 18
From: Virginia

Since your PkgID is being entered in a subform, you need to reference the main form. You should be able to do this with:

[MainFormName]![sfrmWording]!Form.PkgID = me.PkgID

or with

me.Parent.sfrmWording.Form.PkgID = me.PkgID

and "sfrmWording" should be replaced with the name of the subform control (which may not be the same as the source object for that control).

For example, I generally rename my subform controls with a prefix of "sub_", so in my database the subform control name might be "sub_Wording"

Dale Fye
Microsoft Access MVP 2013-2016
Developing Solutions, LLC
Go to the top of the page
post Jul 18 2019, 08:24 AM

Posts: 71
Joined: 12-March 04

Thank you, Grover Park George and dale.fye for your quick response. me.Parent.sfrmWording.Form.PkgID = me.PkgID did the trick!

I am forever indebted to UA for all that I've learned over the years and whenever I stumble, you guys/gals are here to pick me up and get me on my way again!

Thank you! Thank you! THANK YOU!

Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    20th September 2019 - 05:26 AM