Results 1 to 5 of 5
  1. #1
    Antonio is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37

    Replacing Entire Records with a series of fixed new records

    Hi there,




    I have a dataset that needs to have its records translated into new, fixed records, but I am unable to do this (I looked up Append and Update records but neither seemed to solve what I am attempting).

    Here is a sample of data I have:

    ContactID SolicitCode
    1 everydayHero Opt Out
    2 Email opt in
    3 Email opt out
    4 everydayHero Opt Out

    The 'everydayHero Opt Out' SolicitCode needs to be replaced with 4 SolicitCode codes:
    Email opt out
    Postal opt out
    Telephone opt out
    SMS opt out

    So the resulting dataset needs to look like:

    ContactID SolicitCode
    1 Email opt out
    1 Postal opt out
    1 Telephone opt out
    1 SMS opt out
    2 Email opt in
    3 Email opt out
    4 Email opt out
    4 Postal opt out
    4 Telephone opt out
    4 SMS opt out

    I imagine this is fairly easy to do, any ideas anyone?


    Antonio

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    There seems to be no pattern between the 4 sets of data shown so a series of update queries probably won't do the job
    Also, knowing your dataset from previous thread) I know this is just a tiny part of the whole thing.

    You will need to do one or more delete queries to remove records you don't want & several append queries to add new records you do want
    Neither is difficult once you have defined the criteria for doing each step
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,656
    I would open a recordset selecting all records where SolicitCode = everydayHero Opt Out then
    loop through the recordset adding the 4 new records along with the contactID. Then delete all the records with everydayHero.
    Assuming contactID is a foreign key in the table.

  4. #4
    Antonio is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37
    Actually, I have decided to do this in Excel directly because, at least for me, its quicker.

    Thanks for your input again Colin.

    As already mentioned, when I get to the stage of 'grouping' data together, I will let you know how I get on with the other issue I posted.

    Who marks an issue as resolved on this forum? It is the administrator or me?


    Antonio

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    You should mark it solved. Click on the Thread Tools dropdown
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. printing records into fixed area on a report
    By cfljanet in forum Reports
    Replies: 8
    Last Post: 11-22-2017, 03:29 PM
  2. Replies: 3
    Last Post: 07-19-2017, 03:16 PM
  3. Replies: 6
    Last Post: 04-17-2017, 04:47 PM
  4. Replies: 6
    Last Post: 05-10-2014, 05:11 PM
  5. Replies: 3
    Last Post: 05-03-2011, 01:36 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