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

Need Help With Subform

Status
Not open for further replies.

jjones100

Technical User
Nov 12, 2004
23
US
I have a form and 1 subform. Subform has a checkbox that when clicked, will trigger an email to be sent with several of the fields that are located in the subform table. The code is simply:
Email = "J.R.J@yahoo.com"
Copies = "SJ.R@yahoo.com"
SiteName = Forms!PendingSubform!SiteName.Value

I get an error that Access can not find my subform, PendingSubform. How can I fix this? Thanks for any help!
 
This is because the line starting

SiteName =

refers to the PendingSubform from the root of the forms collection.
From the perspective of Access, this is a sub form of the current form. If you need to address this from the top level of the forms collection, you would use something like:

Forms!ParentForm.Form!PendingSubform.Sitename.Value

As the checkbox is on the subform (ie they are on the same form), you can replace it thus:

SiteName = Me.SiteName.Value

John

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top