Reference subform field from macro on form listbox error (1 Viewer)

BJF

Registered User.
Local time
Today, 17:50
Joined
Feb 19, 2010
Messages
111
Hello,

I cant seem to figure how to reference a subform field in a macro on my main form.
I use the macro on a listbox so when a record is chosen, it locks certain fields.
The macro is working fine to lock main form fields but when I add an action referencing my subform field, I get the error "Thecontrol name is misspelled or referes to a control that doesnt exist.

as with vba code , i use the following syntax to reference my subform field

control name : forms!frmSalesOrders!fsubProductNew.form!WidthInches
property : locked
value : true

I also tried me!fsubProductNew.form!WidthInches but the macro fails when I add this action.
 

Ranman256

Registered User.
Local time
Today, 17:50
Joined
Apr 9, 2015
Messages
3,698
use the BUILDER to make sure the path (and property) is correct. (it wont get it wrong)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:50
Joined
Oct 29, 2018
Messages
13,735
The thing to remember when dealing with a subform is that it may have two names associated with it. If so, you'll have to make sure you use the one assigned to the control and not the one assigned to the form.
 

arnelgp

error reading drive A:
Local time
Tomorrow, 06:50
Joined
May 7, 2009
Messages
11,141
use Event Procedure:

[fsubProductNew].Form!WidthInches.Locked = True
 

BJF

Registered User.
Local time
Today, 17:50
Joined
Feb 19, 2010
Messages
111
Thanks for the replies, i ended up simply putting the code on the on current event that arnelgp recommended. Thank you
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:50
Joined
Oct 29, 2018
Messages
13,735
Thanks for the replies, i ended up simply putting the code on the on current event that arnelgp recommended. Thank you
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom