Results 1 to 5 of 5
  1. #1
    BrittKnee is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2020
    Posts
    17

    Populate Form Based on Another Form

    I currently have a form with a command button that opens a pop up form to allow the user to enter notes for the client they were viewing. I need the contact_name in the popup form to automatically fill based on the previous form. I can't seem to get any code to work for this. All help is appreciated.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You could parse the contact_name in the OpenArgs parameter and then use the OpenArgs property to supply a value to a text box on the second form.

    Another way would be to have a text box on the second form reference a control on the the first form for the data, but the first form would need to be kept open for that to work.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    BrittKnee is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2020
    Posts
    17
    The first form is kept open. I am a novice, so I'm not sure of the code or where to put it. I assume the OpenArgs would be in the OnLoad event for the pop up form?

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by BrittKnee View Post
    The first form is kept open. I am a novice, so I'm not sure of the code or where to put it. I assume the OpenArgs would be in the OnLoad event for the pop up form?
    As you say you are a novice, try this:

    On the second form, create a text box. Set its Control Source property to: =Forms![NameOfFirstForm].[NameOfControlThatHasRqdData]

    Substitute the bits in red for the real names used in your db.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    You should not be storing contact_name in the related Notes Table.

    You would use the Open Args to populate the ForeignKey from the Contacts Table to establish the relationship

    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 9
    Last Post: 05-03-2020, 11:08 AM
  2. Replies: 1
    Last Post: 12-10-2016, 02:54 PM
  3. Replies: 7
    Last Post: 10-13-2016, 12:32 PM
  4. Populate Subform based on Form
    By N7925Y in forum Forms
    Replies: 4
    Last Post: 09-29-2016, 07:15 AM
  5. Populate one form field based on another
    By jhrBanker in forum Forms
    Replies: 6
    Last Post: 06-01-2013, 09:28 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