locking a text box in a subform

J

jjmclell

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
 
J

jjmclell

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

Nevermind, I figured it out.

Forms!frmMain!subfrm1.Form!subfrm2.Form!Textbox.Locked = True
 
N

NetworkTrade

maybe your syntax logic is wrong depending on how one interprets your
message; is Subform2 a sub of Subform1? or are all the subforms subs of the
main? Your syntax is the former but perhaps should be the latter....
 
S

scubadiver

In your code "subfrm1" is the name of the form, not the subform.

You don't need "subform1" in the code unless you have one subform nested in
the other. If you do then the referencing you have given needs to show the
form and both subforms.

I don't do subform nesting to that extent so I honestly can't tell you what
the code would be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top