Results 1 to 5 of 5
  1. #1
    spikemannen is offline Novice
    Windows 11 Office 365
    Join Date
    May 2024
    Posts
    2

    Create multiple predefined records in 2nd table onClick based upon values in a 3rd table

    Hi,



    I have a bit of struggle figuring out how to (in an easy way) create multiple records in a 2nd table when user click on a button in a form with another recordsource.

    Scenario:
    User is in HOME form with recordscource = tblUser.
    Upon selecting to enter a competition I want to create a number of predefined records for that user in another table (tblScorecard).
    The predefined values for the records in tblScorecard is userID (same for every created record) and matchID which comes from tblMatches where gameTypeID = 1.

    So let's say that tblMatches has 10 records with gameTypeID = 1, then I would want ten records created in tblScorecard with the same userID, one record per each unique matchID.

    Much appreciate any and all suggestions on how to approach this.
    Thanks

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Use an append query.
    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

  3. #3
    spikemannen is offline Novice
    Windows 11 Office 365
    Join Date
    May 2024
    Posts
    2
    Yes, but how do I define in that query that I want a different matchID for each of the ten records? (and not knowing it is ten)

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I would be building the query in vba and a loop for as many records as required.
    You would populate the fields with your userid and whatever else you need in that record.
    Google 'access append query vba'
    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

  5. #5
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Might be easier if you upload a sample with just enough info to show your issue.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. Replies: 7
    Last Post: 07-26-2016, 07:24 PM
  2. Replies: 3
    Last Post: 08-20-2015, 09:49 PM
  3. Replies: 1
    Last Post: 02-16-2013, 11:36 AM
  4. Replies: 2
    Last Post: 01-22-2010, 03:53 PM
  5. Replies: 3
    Last Post: 06-01-2009, 01:41 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