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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen.ActiveForm.mySubForm.Form.myComboBox invalid reference 2

Status
Not open for further replies.

jmodo

Programmer
Aug 2, 2006
43
US
in one of my access databases, this call works, but in another I can't get it to work. They are both the same version, and contain the same code. One is a test version, the other release.

Screen.ActiveForm.mySubForm.Form.myComboBox

I need to get the value from the comboBox.
Thanks!
J
 
Something very usefull would be to look at


PHV already posted this many times, and it is very helpful regarding controls, which I think would be your problem.

**note** to reference a form or subform control, you need that specific form opened. Maybe that is the difference between ur 2 databases

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
I can't use that syntax, because this code resides in a module, which is shared by many forms using the same subform.
Forms![main form name]![subform control name].Form![control name]
I need something that references the form indirectly, along the lines of:
Screen.ActiveForm.mySubForm.Form.myComboBox

Thanks.
 
I think I figured out a way.
I can get the form name with myForm=Screen.ActiveForm.Name,
then use that syntax:
Forms![main form name]![subform control name].Form![control name], but somehow I need to switch the [main form name] with myForm.
How do I do this so that Access interprets it right?
 
Forms(Screen.ActiveForm.Name).Controls("subform control name").Form![control name]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I don't know if it is actually possible... I don't know of any function running a string and declaring it as a vb built in reference.... That would be an interesting follow up...

Ill be searching

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Thank you PHV for that awnser

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top