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

BJF

Registered User.
Local time
Today, 15:01
Joined
Feb 19, 2010
Messages
133
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

Well-known member
Local time
Today, 15:01
Joined
Apr 9, 2015
Messages
4,339
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, 12:01
Joined
Oct 29, 2018
Messages
21,453
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:01
Joined
May 7, 2009
Messages
19,231
use Event Procedure:

[fsubProductNew].Form!WidthInches.Locked = True
 

BJF

Registered User.
Local time
Today, 15:01
Joined
Feb 19, 2010
Messages
133
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, 12:01
Joined
Oct 29, 2018
Messages
21,453
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