How to Update Query using Total Count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dawn123
    New Member
    • Nov 2009
    • 15

    How to Update Query using Total Count

    I have two tables.. I want to update one table with the count of each colume from the pervious table. I have been able to do it using the query bulider and when ran, it works but I want to take the SQL statment and copy it into my moduel however it won't work. It will not let me format the SQL statment and remove put the whole statement on one line. I'm new at this so I don't really understand why I am unable to do this. Below is the code I have. I also have done this with other update querys that I didn't count, just simply copied from one table to another and that worked fine.

    I use db.execture "the sql stament" because the query is so long it copies it one two lines and when I try and make it all one one line it doesn't work. Its at the point where its (SELECT COUNT(BlockRege nTemp From BLOCKNUM) AS CountOfBLOCKNUM .


    Thanks
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32634

    #2
    Dawn, please try to explain this using code (in CODE tags) that is copy pasted. Typos in code are unnecessary and can waste much time and effort.

    By the way, I'm pretty confident we can help once we have a clearer understanding of the question.

    Welcome to Bytes!

    Comment

    • nico5038
      Recognized Expert Specialist
      • Nov 2006
      • 3080

      #3
      When you have a working query, just execute this like:

      Code:
      CurrentDb.Execute ("Your_qryUpdate_Name")
      Nic;o)

      Comment

      • dawn123
        New Member
        • Nov 2009
        • 15

        #4
        Thanks for your reply! Thats what I used and it worked. But I also figured out why it would't work the other way in the first place.. Pretty simple and stupid of me but I have never had it happen before so I did learned from it. It was that my query was to long for one line.. I got it working now so thats what matters! Thanks again for all the help! :)

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32634

          #5
          That's all good then. Well done :)

          Comment

          Working...