Setting a value in a subform

J

John Michael

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
 
V

Van T. Dinh

Forms![Clock Out]![Clock Out Subform *CONTROL*].Form!
[txtIOUAmountPaid] = 64

(type as one line in your code)

Note that you *need* to use the Subform*CONTROL* name
which may be different from "[Clock Out Subform]" (I guess
this is the name of the Form being used as the "Subform").

HTH
Van T. Dinh
MVP (Access)
 

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