Solved

How to update a form field from a subform field

Posted on 2012-04-13
7
299 Views
Last Modified: 2012-05-01
I have a form that contains a job supervisor's name field.  The subform has the many supervisors that could be the actual job supervisor.  I want the form's supervisor field to be populated by the correct supervisor based on the user scrolling through the subforms' content .  When they find the correct supervisor, I want the user to hit a button on either the form or subform (whichever you think is best) to update the form's job supervisor's name with the correct supervisor's name from the subform.  Please help me determine how to make this work.  Thank you.
0
Comment
Question by:PJ_KD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 21
ID: 37842841
I would recommend using a combo box to select the supervisor instead of a sub form.   It is also much easy to implement.
0
 

Author Comment

by:PJ_KD
ID: 37843006
Could the combo box be based on content from the other record?  (There is a JO record that is the source of the main form and the Contact record is the basis of the subform.)  If so, how would that be done?  Also, there are three fields involved which are the first and last name for the supervisor and the supervisor's email address.
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 400 total points
ID: 37853098
PJ,

I would agree with HiTechCoach, that the simplest way would be to use a combo box on the main form, but without actually seeing an example of your setup, I'm not sure how to answer your question:

"Could the combobox be basedon the content from the other record?"

If you put a button (cmd_Select) in the footer of your subform, then you could use code similar to the following:

Private Sub cmd_Select_Click

    me.parent.txt_SupervisorName = me.txt_SupervisorName

End Sub

Although I personally prefer to store the EmployeeID in the SupervisorID column.

HTH
Dale
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Assisted Solution

by:PJ_KD
PJ_KD earned 0 total points
ID: 37853333
I think that this may have solved my problem.  I put the button in the footer if the subform as you recommended.  
I received an error with the above Sub but did a slight change to:

Private Sub cmd_Select_Click

     Forms![main form name]![txt_SupervisorName] = Me.txt_SupervisorName

End Sub

I need to test it a little more tomorrow and will award appropriate points at that time.  Thank you for the assistance.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 37855375
Yes, that should work as well. The syntax:

me.parent.controlname = xxx

should work, what error are you getting.
0
 

Author Closing Comment

by:PJ_KD
ID: 37913916
I appreciate the help.  I didn't get a chance to go back and see the error message generated by the original recoemmended solution but that hit allowed me to work through to a solution that I have now implemented in my database.  Much appeciated..
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question