Results 1 to 7 of 7
  1. #1
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55

    Copy one record to another record on the same table


    Hello,

    Im trying to make a query that will copy data from one record to another already created record. As you can see in the picture I have all the records pre filled out with the tag numbers so they can pick them from a drop down list.

    The user will select Update Tag Number, Then select the Curent tag number they want to change, then they will select the new tag number they want it to be. In this case we are changing tag number 1204 to tag number 1206. Now i need a query that will take the Info highlighted in red from the 1204 record and copy or move it down to the 1206 record once the save and exit button is clicked.

    This is the current Query im using but its not working and im not sure what else i can do. If there is another way to do this that might be easier im open for suggestions also.

    Thanks

    Code:
    UPDATE USTagT SET USTagT.TemmisNum = [Forms]![USTagInOutF]![TemmisNum], USTagT.Description = [Forms]![USTagInOutF]![Description], USTagT.NSN = [Forms]![USTagInOutF]![NSN], USTagT.PartNum = [Forms]![USTagInOutF]![PartNum], USTagT.SerialNum = [Forms]![USTagInOutF]![SerialNum], USTagT.Location = [Forms]![USTagInOutF]![Location], USTagT.Notes = [Forms]![USTagInOutF]![Notes]+[Forms]![USTagInOutF]![Combo120], USTagT.SignedOut = Yes, USTagT.USTagNum = [Forms]![USTagInOutF]![Combo231]
    WHERE (((USTagT.USTagNum)=[Forms]![USTagInOutF]![Combo231]));
    Thanks for the help
    Attached Thumbnails Attached Thumbnails USQueryHelp.jpg  
    Last edited by MunroeM; 01-13-2016 at 07:58 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    "not working" means what - error message, wrong results, nothing happens?

    Don't see need for the expression to change USTagNum value but should not hurt.

    Once 1206 is populated with 1204 data, does 1204 need to be all set to Null?

    This is odd process. I suspect data structure is not optimal. Sounds familiar - think I've worked with your other threads.
    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
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    Sorry, Not working means nothing is happening in this case. You have helped me out a number of times already on different sections of this project im working on.

    Correct once tag 1206 is populated with the 1204 data i will be clearing all the data from tag 1204 except for the tag number. So in the photo of the table above 1204 would look just like all the other tags you see there after it has been moved to 1206.


    The reason i am doing this is because once you sign out a tag for a tool, sometimes you need to change the tag you signed out with a different one. Instead of making them sign the tag in, then sign out and re enter all the info again for the new tag. I want to give them the option to just change the tag number. But because i have all my tags pre entered i cant just change the tag number as i will have duplicate tag #'s and missing tag #'s.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    And that's what a 'junction' table is for - to associate records in a many-to-many relationship.

    Regardless, I cannot see reason for the query failure. Are both tag combos UNBOUND?

    Might help if you gave controls meaningful names.

    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.

  5. #5
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    Here is a cut down version of my data base. The U/S tool tag register is the one i need to have the update for

    Thanks for helping
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I would not run a query object. I would run SQL statement in VBA. Regardless your query should work.

    I don't set Modal and Popup during development - gets in the way - and seldom use these settings in deployed db.

    I clicked U/S Tag Register button. I put a breakpoint in the Save button code. The code always goes to the first ElseIf Me.SignInOut.Value = 3 and never runs the query in the second ElseIf Me.SignInOut.Value = 3 at the end of the conditional code. Fix the code so you have only one test on this condition.

    Suggest you learn more about how to debug code. I would go nuts if I couldn't set breakpoint. Review link 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.

  7. #7
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    I know exactly what part you are talking about. I definitely overlooked that when i wrote that part of the code. I was trying to make it so if the update button is selected and one or both of the combo boxes has nothing entered it would tell you to pick a tag number from the combo boxes.

    Thanks for the link to the Debugging. This is something I really need to learn and im sure it will be a valuable tool to know

    thanks for the help

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

Similar Threads

  1. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  2. Replies: 3
    Last Post: 05-27-2014, 09:31 AM
  3. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  4. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  5. Replies: 4
    Last Post: 11-10-2011, 03: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