Getting a value from a subform contained in a tab control

G

Guest

SITUATION:

My main form has...
a Tab Control that has...
subform1 in tab 1 (and other subforms in other tabs).
subform1 displays continuous records:
Value1 Value2
Value1 Value2
etc.

Whenever Value2 is double-clicked in any record, I need to capture value1
for that record and store it in a global variable. Have tried various ways
of referring to Control1 (the control that contains Value1), but have either
gotten various "can't find it" errors or have gotten the Control1 value for
the FIRST record displayed in subform1, no matter which record the
doubleclick happened in. Help, help, help.
 
R

ruralguy via AccessMonster.com

Are you putting code in the DoubleClick event of the Value2 control in the
SubForm? Where is the Global variable defined? What code have you tried?
 
G

Guest

Yes, the doubleclick module causes some things to happen, and what I now want
to happen FIRST is that it captures the value I described from the subform
and puts it in the global variable.

The global variable is defined in a separate "Globals" module so it's
accessible from anywhere, not just from the subform-associated code.

I've experimented with several different variations of the
Forms!MainForm!subForm1.Forms.Controls "name-ology," adding or taking out
various pieces to try to find the right object string, but haven't hit on the
right one yet. As I said, the closest I've come does indeed capture a value
and place it into the global variable, but it's Value1 from the FIRST record
in the subform, not from the record where the double-click action happened.
 
R

ruralguy via AccessMonster.com

When you click or doubleclick in a field in a continuous form, that record
becomes the Current Record for the form. If the code is in the DoubleClick
event of the control for Value2 then I would thing that GlobalVariableName =
Me.Value1ControlName would do it. Using your names of course!
Yes, the doubleclick module causes some things to happen, and what I now want
to happen FIRST is that it captures the value I described from the subform
and puts it in the global variable.

The global variable is defined in a separate "Globals" module so it's
accessible from anywhere, not just from the subform-associated code.

I've experimented with several different variations of the
Forms!MainForm!subForm1.Forms.Controls "name-ology," adding or taking out
various pieces to try to find the right object string, but haven't hit on the
right one yet. As I said, the closest I've come does indeed capture a value
and place it into the global variable, but it's Value1 from the FIRST record
in the subform, not from the record where the double-click action happened.
Are you putting code in the DoubleClick event of the Value2 control in the
SubForm? Where is the Global variable defined? What code have you tried?
[quoted text clipped - 15 lines]
 

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

Top