Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

locking a textbox in a subform

Status
Not open for further replies.

jjmclell

Technical User
Aug 10, 2007
34
CA
Hi there,

I've got a form that looks like this:

MAIN FORM
SUBFORM1
SUBFORM2
SUBFORM3

I'm trying to code an event in a listbox in SUBFORM1 that locks a textbox in SUBFORM2 if the user picks a certain item from the list. However, I can't seem to get the code right in order to do it. I tried this:

If whatever Then
Forms!subfrm1.subfrm2!Listboxname.Locked = true
End if

However it keeps telling me it can't find subfrm1.

Any ideas?

jjmclell
 
You seem to be short a couple of forms:

[tt]Forms!subfrm1.Form.subfrm2.Form.Listboxname.Locked = true
[/tt]
 
Ok, well I figured it out, but this is how it had to be:

Forms!frmSFI!subfrm1.Form!subfrm2.Form!Textbox.Locked = True

I guess the "!" denotes a control within a control...and I guess subforms are controls. It's always fun learning a new language haha.

Thanks for your help.
 
Have a search for Bang versus Dot. They can mostly be used in the same way. Some people favour dots, some favour bangs.

In referring to subforms, you must first refer to the control by name, the to the form contained as Form. In most cases the form contained and the subform control have the same name, which can lead to confusion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top