Results 1 to 7 of 7
  1. #1
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46

    Linking Forms-Auto Populate Form A to Form B

    Hi,


    I have created an auto populated drop down for the user data entry Form. The user clicks their employee ID their First Name, Last Name and Department appear in the corresponding fields.
    This is the code in Form A.

    Private Sub EMP_ID_Change()


    Me.txtFirst_Name.Value = Me.EMP_ID.Column(1)
    Me.txtLast_Name.Value = Me.EMP_ID.Column(2)
    Me.txtDepartment.Value = Me.EMP_ID.Column(3)
    Me.txtLocation.Value = Me.EMP_ID.Column(4)
    End Sub

    What I would like to do is link Form A to Form B when the user clicks their employee ID in Form A it will auto populate in Form B.

    Thanks

    Holli

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    VBA is not necessary to display these values in textbox. Expression in ControlSource property could be:

    =[EMP_ID].[Column](1)

    Are Form A and Form B in form/subform arrangement? Have you set the subform container Master/Child Links properties?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Thanks June 7

    No they are not in form/subform arrangement. Originally they where separate main forms, but my boss wanted them to be rolled together. I created a Button(Macro) now he doesn't want the employee to have to select their employee ID for each form.

    Holli

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If these forms have a dependent relationship, set the Master/Child Links properties to the PK/FK fields. The PK will automatically populate into the subform record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    They don't have a dependent relationship. They are separate data entry forms (survey questions)

    Thanks

    Holli

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't understand the data structure. If you want to provide db for analysis, follow instructions at bottom of my post.

    Requires code to pass data between unlinked forms. Several ways to accomplish. Which one to use depends on structure of forms and how you want them to behave.

    One way is code in Open or Current event of Form B that refers to open Form A

    If Me.NewRecord Then
    Me.EmpID = Forms!FormA!EmpID
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Great Thanks June 7

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-16-2014, 12:32 PM
  2. Sub Form auto populate
    By keiath in forum Forms
    Replies: 4
    Last Post: 02-14-2014, 02:59 PM
  3. How to auto populate in tex box form
    By kft10 in forum Forms
    Replies: 3
    Last Post: 06-12-2013, 11:47 PM
  4. Replies: 63
    Last Post: 01-25-2013, 05:20 AM
  5. Replies: 2
    Last Post: 10-24-2012, 02:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums