reference subform field when clicking mainform control

G

Guest

I've reviewed other simlar postings and have tried several versions to no
avail (I'm obviously overlooking something). I have a mainform with a
subform. After filling in both forms, the user selects a "Process" button on
the main form. The click event for the button edits the fields on both the
main forma nd subform.

the mainform edits work fine, but the subform edits are failing (reference
errors). The mainform is AddProject, the subform is AddChargeNumber (with
caption and record source both being "costaccountnumber"). One control on
the subform is CANumber. The error I get is ...can't find the field
"...AddChargeNumber' referred to in your expression"..... I've pasted one of
the current references below:

MsgBox (Forms![AddProject]![addchargenumber].Form![CANumber])

thanks,
Dan
 
M

Marshall Barton

dfeigen115 said:
I've reviewed other simlar postings and have tried several versions to no
avail (I'm obviously overlooking something). I have a mainform with a
subform. After filling in both forms, the user selects a "Process" button on
the main form. The click event for the button edits the fields on both the
main forma nd subform.

the mainform edits work fine, but the subform edits are failing (reference
errors). The mainform is AddProject, the subform is AddChargeNumber (with
caption and record source both being "costaccountnumber"). One control on
the subform is CANumber. The error I get is ...can't find the field
"...AddChargeNumber' referred to in your expression"..... I've pasted one of
the current references below:

MsgBox (Forms![AddProject]![addchargenumber].Form![CANumber])


To debug this kind of thing, reduce the reference to simpler
expressions (e.g. Forms![AddProject]![addchargenumber].Name)
until you identify the incorrect element. Then figure out
what the correct element should be.

In this case, I would suspect that addchargenumber is not
the name of the subform control (which may be different from
the name of the form object it is displaying.
 

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