Results 1 to 6 of 6
  1. #1
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25

    Add record to form from subform button

    Hi

    I have a subform (a correspondence table) with a button which opens a form containing a client list. I'd like a client to be added to the correspondence table by double clicking on the form.


    The form is tbl_projclienti, the button is the one on the right which opens a client list, I'd like the record to be added by double clicking on the specific client.
    Any help?Progetti.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    run an Append query to add the record to the table in the dbl-click event.

  3. #3
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25
    Thanks,

    Don't really know how to do but I'll try, anyway I suppose it is possible to add just some record of a table to some records of a different table (I mean the table are not the same).

    Thanks

  4. #4
    cesarone82 is offline Novice
    Windows 11 Access 2016
    Join Date
    Jun 2009
    Posts
    25
    I tried a bit,

    But I don't understand how to specify that the value to append to the append query should be a specific value in the recordset clicked , and the other value should be the value identifying the project number of the form project which is open.

    It is a bit tricky, if you open the attached file you should understand what i mean

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You would build an Insert query sql in vba, concatenating the values required.
    You could pass in the required project number in as an OpenArgs or set a tempvar to that value.
    Then you have both the values required for the record.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi
    You need to get your relationships between tables correct before doing anything else.

    tblClients - You have the PK set as just a Number DataType - It should be an Autonumber

    tblProjects - you are linking the field PjNum which is a Number Datatype to the PjNum in all related tables
    (tblPjEntries/tblProjclients/tblProjProf & tblProjimprese)

    You should be linking the PK PjID from tblProjects to all related tables on a field named PjID and NOT PjNum)
    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: 6
    Last Post: 03-09-2022, 06:46 AM
  2. Replies: 4
    Last Post: 03-18-2019, 08:50 AM
  3. Replies: 4
    Last Post: 08-10-2018, 12:00 AM
  4. Button open selected record in subform table, in new form
    By BrainExplodingFromCoffee in forum Forms
    Replies: 4
    Last Post: 04-12-2016, 02:19 PM
  5. Replies: 6
    Last Post: 05-18-2013, 12:48 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