Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2020
    Posts
    19

    When adding new record, not recording id from parent table.

    Hi, I would really appreciate some help please.

    I have a form where you select the client name from an unbound cmbbox. Then user can update a new activity for the client in the subform. After I save it, the client id (from the activity table) which should correspond to the client id from the parent table, is blank. How do I populate the client id in the activity table when I add a new record please?

    Also, I have another form the uses a combo box. I would like the combo box to be blank after a user selects a client. The client is populated in another field after the selection is made but how do I make the combo box show blank until user clicks on it to select another client please.



    code.zip
    Last edited by bratneedshelppls; 06-25-2020 at 06:26 PM. Reason: Another question please

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    1. If this is a form/subform arrangement and Master/Child links are set, primary key ID should automatically save into dependent record without any code.

    2. If combobox is UNBOUND, simply Me.comboboxname = Null - real trick is figuring out what event to put code into.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Join Date
    Jun 2020
    Posts
    19
    Thank you, I've attached the db.

    THere's another thing i'm trying to do which I have no idea how to do. In the clients table, let's say we have a husband and wife listed and they each have a different id. They will have a familyid to link them. On the client form, I have a tab which will show the activities of the client. I would like that tab to show all the activities for the husband and wife for the one family id. So if look up Bob, I will see all the activities that have been entered under his name and his wife's. Similarly, if I look up his wife, I'd like to view all the activities entered for her and her husband. The purpose is to not have to enter a note twice, under both names.

    I am very greatful for any help you can give me here. I've been researching and not coming up with solutions.

    Thank you,
    Tess
    Attached Files Attached Files

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum.


    The first thing I would do is convert ALL macros to VBA code. I quit scripting when Excel added VBA programming. (many, many, many years ago)


    You could try using the sub form BEFORE UPDATE event.
    Set the sub form ClientID_FK field/control to the main form unbound combo box's ClientID_PK field/control.

    Or do as Jane7 suggests and post your dB.


    Edit: too late........ again!

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Items to fix: "Date" (table Opportunities) is a reserved word in Access.
    Many objects have spaces in the names.
    Should not use special characters in object names (tables Business Partners, Relationships & Clients---> E-Mail)
    You have a lot of Look up FIELDS in the tables. Should not use Look up FIELDS in tables.

    The PK fields in 2 tables are linked to the same field in table Clients. It looks like the Business Partners PK field should be linked to the BusinessPartnerID FK field in table Clients?


    I am not sure how you are linking a husband and wife to get a FamilyID..... have to think about this.

  6. #6
    Join Date
    Jun 2020
    Posts
    19
    Hi Steve,
    I'll fix the spaces and special characters and look up fields.

    Yes, the Businesspartner pk should link to the businesspartneid in table clients.

    I guess I have lots to fix.

    Thanks for your help.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2018, 05:33 PM
  2. Replies: 4
    Last Post: 05-04-2017, 01:16 AM
  3. Replies: 7
    Last Post: 03-06-2017, 08:43 AM
  4. Recording multiple values of same type to one record
    By twelvedigits in forum Database Design
    Replies: 2
    Last Post: 01-27-2016, 07:40 AM
  5. Replies: 3
    Last Post: 08-09-2012, 01:49 PM

Tags for this Thread

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