1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Automatically populate info into field after subform updates, Access 2007, OB

Discussion in 'Business Applications' started by ginaw, Feb 2, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    I have a form with a subform. When I enter the Employee number in the appropriate field, the subform updates with the employee's information. I then want my form (not subform) to automatically populate in another field from the subform that has the individual employee's information. How can this be done. I have racked my brain and I know there has to be a way. OBP, are you out there?
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Is your main form a bound or unbound form?
     
  3. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    Rockin, The main form is bound.
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Why do want to populate the Mainform with subform data?
    Do you actually want to store the data, which is data duplication and not a good idea.
     
  5. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    What I really want to do in my form is populate the field with information from another table. I have a child parent relationship established between the forms but the field will not pull the appropriate information. I have a data input form. I have a subform. The child parent relationship is between the Employee ID number in an Employee table and the Data input form. The primary key is the NationalEmplNumber in the Employee table and the child is the EmployeeId field in the Data input form. I want to pull info from a different field within the Employee form into a field in by Data input form, but it only gives me #Name. This would say to me that the field name is wrong but they are the same in both tables.
     
  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You are correct, the #name means that the name on the form is not matching the name in the Form's field list.
    So check the field list and the Record source and ensure that the form'e field Control Source is correct (not it's name as they can be different).
     
  7. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    OBP, I managed to bring in the data by basing my form on a query. Now the problem is that I want to be able to overtype the information in the field and write the data to a different location then where the data is pulled from.
    EX: The rate field is pulling from the Employee table. I want to be able to overtype this field and the information written back to the main Bonus table. The information is not being written back to the table. Is there code to do this?
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Is it being written back to the Employees table?

    You can transfer the data from an Employee field to a Bonus field, which can be overwritten if required.
     
  9. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    OBP, Thanks for your speedy reply!! Yes. The data is being written back to the employees table. I do not want this altered at all as that is the original bonus amount. I do however want to be able to overtype this field in the form with a new amount if needed and this amount be written to the main table.
     
  10. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You need to ensure that the field that you want to write the data to is on the form.
    Then you need some simple VBA in the Form's "On Current" event procedure
    me.bonustablefieldname = me.rate
    where bonustablefieldname is the name of the field that you want the data in.
    You should also make the rate field invisible.
     
  11. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    OBP, I have tried your suggestion but it still doesn't work. I would like to send you my dbase but it exceeds 719 K. Can I email it to you?
     
  12. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Have you compacted & repaired it, that should reduce it a lot before Zipping.
     
  13. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    OBP, I can only get it down to 544KB.
     
  14. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    OK, I will private mail you my email address.
     
  15. ginaw

    ginaw Thread Starter

    Joined:
    Sep 8, 2010
    Messages:
    81
    Thanks OBP,

    I am working in 2007 but saved it as 2003. Hope you can see where I am going wrong.
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/978485

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice