471,078 Members | 843 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,078 software developers and data experts.

Setting a value in a subform

I have a form that has a subform that has a subform.

The subform loads a record based on a combo lookup box in the main form.
I'm trying to set a value in the subform based on a value in a subform of
the subform.

the main Form is called [Clock Out]
Subform is called [Clock Out Subform]
Subform in the subform is called [Pay IOU Subform]

The proceedure i am running is from the On Dirty event proceedure in the
[Pay IOU Subform] .

I am trying to set a value for the text box named [txtIOUAmountPaid] in the
[Clock Out Subform]

I can copy the [txtIOUAmountPaid] text box to the [Clock Out] main form and
set the value there using:

Forms("Clock Out")("txtIOUAmountPaid").Value = 64 'Note:Using 64
to test it.

in the on dirty event proceedure which runs when there is a change in the
[Pay IOU Subform].

however, I am unable to set the value if the control is in the [Clock Out
Subform].
For some reason I can't find the [Clock Out Subform]
I've typed this in the immediate window to see if the forms exist.
? CurrentProject.AllForms("Clock Out Subform").IsLoaded
False.
? CurrentProject.AllForms("Clock Out").IsLoaded
True
? CurrentProject.AllForms("Pay IOU Subform").IsLoaded
False
I am assuming that I can't set the value becuase the subforms don't appear
to be loaded. But they should be. I can set other values in the subform if
I type them in and they are saved with the record. Why are the subforms not
showing up with the isloaded call.
How can I set a control in a subform. I have tried 30 or so different
combinations with dots & exclamation points with no luck.

Any help appreciated
thanks
john michael

Nov 13 '05 #1
1 7467
When a form is a subform, it is not part of the Forms collection, so you
can't reference it that way. You'll need to use the syntax:

Forms!Main_Form_Name!Subform_Control_Name.Form!Con trolName
(there is a shortened version of this, but this is less prone to
misunderstanding IMHO).

So if your Clock Out Subform is in a control called sfClockOut, you would
use:
Forms![Clock Out]!sfClockOut.Form!txtIOUAmountPaid
or
Forms("Clock Out")("sfClockOut").Form("txtIOUAmountPaid")

short form:
Forms("Clock Out")("sfClockOut")("txtIOUAmountPaid")

--
Shane Suebsahakarn
----
Head of IT
PAN Telecom
Tel: +44 (0) 870 757 7001

"John Michael" <jo***@acadiacom.net> wrote in message
news:10*************@corp.supernews.com...
I have a form that has a subform that has a subform.

The subform loads a record based on a combo lookup box in the main form.
I'm trying to set a value in the subform based on a value in a subform of
the subform.

the main Form is called [Clock Out]
Subform is called [Clock Out Subform]
Subform in the subform is called [Pay IOU Subform]

The proceedure i am running is from the On Dirty event proceedure in the
[Pay IOU Subform] .

I am trying to set a value for the text box named [txtIOUAmountPaid] in the [Clock Out Subform]

I can copy the [txtIOUAmountPaid] text box to the [Clock Out] main form and set the value there using:

Forms("Clock Out")("txtIOUAmountPaid").Value = 64 'Note:Using 64 to test it.

in the on dirty event proceedure which runs when there is a change in the
[Pay IOU Subform].

however, I am unable to set the value if the control is in the [Clock Out
Subform].
For some reason I can't find the [Clock Out Subform]
I've typed this in the immediate window to see if the forms exist.
? CurrentProject.AllForms("Clock Out Subform").IsLoaded
False.
? CurrentProject.AllForms("Clock Out").IsLoaded
True
? CurrentProject.AllForms("Pay IOU Subform").IsLoaded
False
I am assuming that I can't set the value becuase the subforms don't appear
to be loaded. But they should be. I can set other values in the subform if I type them in and they are saved with the record. Why are the subforms not showing up with the isloaded call.
How can I set a control in a subform. I have tried 30 or so different
combinations with dots & exclamation points with no luck.

Any help appreciated
thanks
john michael



Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by JKop | last post: by
reply views Thread by CSDunn | last post: by
reply views Thread by CSDunn | last post: by
4 posts views Thread by elfyn | last post: by
1 post views Thread by George | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.