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

Insert data from subform textbox into parent form textbox? 2

Status
Not open for further replies.

tylerwork

Technical User
Aug 20, 2002
31
0
0
US
I have in a subform a textbox that has info in it. I have a button that I want to click, and automatically populate a textbox in a text box in the parent form. Don't ask the reason, it's how the user wants it! :)

what line of code will work with this?

I have this but it isn't working:

Me!Inst_By.Value = Me!Forms.Search_Inventory.Installed_by.Value
 
Try this
Me!Inst_By= Me!Forms![Search_Inventory]!Form![Installed_by]
 
Refer to things on subforms like this:
forms!NameOfTheMainForm!NameOfTheControlThatHoldsTheSubform.Form!NameOfControlOnSubformYouWantToReference

"Forms" and "Form" should be in there literally. You have to refer to the name of the control that holds the subform, which may or may not be the same as the name of the subform. I make sure they're always named the same thing, but that's a personal preference thing.

Taking this into account, you'd want to do this:
Me!Inst_By.Value = Me!Search_Inventory.form.Installed_by.Value

Jeremy

PS: Why does the user want this? Really, I'd be interested to hear why. It sounds like you already know it's a weird thing to do, but I'm always curious to learn about users.

=============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
Thanks! and if I want a button in a subform to turn EDITS ON in the parent form, how do I do that?

Me!Forms![Search_Inventory]!Edit = True

that doesn't work
 
Actually neither of those work. Hmm... .says the form name isn't valid
 
Me!Forms![Search Inventory].Form!Edit = True
 
With all of these, it keeps telling me that it can't find the FIELD: "Forms"

Keep in mind that the button I am using is in the Child_Subform, while the location of the actions I want to take is in the Parent_Form.
 
Sorry,It was wrong
Forms![Search Inventory].Form!Edit = True
 
nope, that didn't work either. AGHGHGHG! Frustrating :)
 
Isn't that "AllowEdits", and not "Edit"?

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
What is your control name and type ?

If it is a Check box then

Dim FormName as Form
Set FormName=Forms![Search Inventory].Form
FormName![Edit]=-1 'Checked 0 for Unchecked
 
Got it! it was AllowEdits. DUH :) thanks everyone!!!
 
Forms![Search Inventory].!AllowEdits = True =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top