Results 1 to 7 of 7
  1. #1
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581

    Linking Forms

    I have a form with a button linked to another form using the EmmployeeID to link the forms. I had it open to a new form so I can enter a new record. The EmployeeID did not appear, so in the EmployeeID properties in the Control Source, I linked that number (=[Forms]![EmployeeF]![EmployeeID]). So, when I use the button to open that form it gives me a new form and the EmployeeID is in that field. However, when I save the record, the EmployeeID isn't saved. It shows 0. Ideas?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Using

    =[Forms]![EmployeeF]![EmployeeID]

    in the Control Source means that the Control, on the secondary Form, is Unbound, hence it's not Bound to the Table. To be Bound to the Table, and saved, the Control Source has to have the Field in the underlying Table, not an expression.

    If New Records will always be entered in this fashion, i.e. with the primary Form open and the EmployeeID entered, on that Form, you could use the

    =[Forms]![EmployeeF]![EmployeeID]

    in the Default Value Property on the secondary Form.

    Alternatively, when opening the second Form, you could pass the EmployeeID in the OpenArgs parameter of the OpenForm command, then retrieve the OpenArgs in the OnLoad event of the secondary Form and use it to assign it to EmployeeID in that Form.

    Linq ;0)>

  3. #3
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Linq,
    Thanks for the suggestions. I tried the first option. I put that expression into the default of that field in the secondary form. It still did not save it to the table. I'm not sure how to do the second option.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Did you remember to delete

    =[Forms]![EmployeeF]![EmployeeID]

    from the Control Source of the Control, on the secondary Form, and selected/entered the name of the Field, in the underlying Table, that you want it saved to?

    And using it in the Default Value will only populate it for New Records, not for existing Records. If you have many actual Records already loaded, you'd have to do a one-time Update Query to populate the field for those existing Records.

    Linq ;0)>

  5. #5
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Linq,
    Yes. I deleted it from the Control Source in the secondary form. I apologize for my not understanding. I didn't understand this, "and selected/entered the name of the Field, in the underlying Table, that you want it saved to?"

  6. #6
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    On the secondary form in the EmployeeID field control source, I put in the EmployeeID. With that default expression, it saves exactly like I want it to.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

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

Similar Threads

  1. Linking Forms
    By ChipVerdi55 in forum Forms
    Replies: 10
    Last Post: 06-26-2012, 02:49 AM
  2. linking forms
    By chiefmsb in forum Access
    Replies: 10
    Last Post: 07-08-2011, 03:57 PM
  3. Linking Forms
    By glasgowlad1999 in forum Forms
    Replies: 1
    Last Post: 02-02-2011, 09:35 AM
  4. Linking two forms together
    By Lxmanager in forum Access
    Replies: 8
    Last Post: 09-27-2010, 05:10 PM
  5. Linking Forms
    By dalton in forum Forms
    Replies: 1
    Last Post: 05-30-2010, 11:23 PM

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