Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. update query not updating

update query not updating

Scheduled Pinned Locked Moved Database
databasequestionannouncement
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    turnerdavid
    wrote on last edited by
    #1

    Can somebody tell me why the following isn't working?

    UPDATE JobTicket_024 SET JobTicket_024.file = Replace([file_link],"\\52qjkl-as-004p","F:\CE\CE\CEDrawings");

    I stole this from a previous update I did to the same table. Now I'm just changing the path again. It updates the field "file" with "\\qjkl-as-004p" not the new path. What gives? Thanks in advance. Windows 7 MS Office 10 (32 bit) Access 64bit machine

    Z 1 Reply Last reply
    0
    • T turnerdavid

      Can somebody tell me why the following isn't working?

      UPDATE JobTicket_024 SET JobTicket_024.file = Replace([file_link],"\\52qjkl-as-004p","F:\CE\CE\CEDrawings");

      I stole this from a previous update I did to the same table. Now I'm just changing the path again. It updates the field "file" with "\\qjkl-as-004p" not the new path. What gives? Thanks in advance. Windows 7 MS Office 10 (32 bit) Access 64bit machine

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      You are asking sql to look at the file_link column, find "\\52qjkl-as-004p" and replace it with "F:\CE\CE\CEDrawings" and put the result into the file column. Perhaps a before and after picture would help. However, instead of UPDATE just change to SELECT so you can see what it will do.

      There are only 10 types of people in the world, those who understand binary and those who don't.

      T 1 Reply Last reply
      0
      • Z ZurdoDev

        You are asking sql to look at the file_link column, find "\\52qjkl-as-004p" and replace it with "F:\CE\CE\CEDrawings" and put the result into the file column. Perhaps a before and after picture would help. However, instead of UPDATE just change to SELECT so you can see what it will do.

        There are only 10 types of people in the world, those who understand binary and those who don't.

        T Offline
        T Offline
        turnerdavid
        wrote on last edited by
        #3

        SELECT JobTicket_024.file_link, JobTicket_024.Project_Number
        FROM JobTicket_024
        WHERE (((JobTicket_024.file_link)=Replace([JobTicket_024]![file_link],"'\\52qjkl-as-004v\CE_Data\CE\CEC\oce_drawings'","'F:\CE\CE\CE Drawings'")));

        OK, first I changed UPDATE TO SELECT per your suggestion and I changed it to look at the "file_link" column and replace the "file_link" Interestingly, the query shows a table and then an error message pops up with "Data type mismatch in criteria expression" and as soon as I click "help" it clears the table. And, the field isn't updated either.

        Z 1 Reply Last reply
        0
        • T turnerdavid

          SELECT JobTicket_024.file_link, JobTicket_024.Project_Number
          FROM JobTicket_024
          WHERE (((JobTicket_024.file_link)=Replace([JobTicket_024]![file_link],"'\\52qjkl-as-004v\CE_Data\CE\CEC\oce_drawings'","'F:\CE\CE\CE Drawings'")));

          OK, first I changed UPDATE TO SELECT per your suggestion and I changed it to look at the "file_link" column and replace the "file_link" Interestingly, the query shows a table and then an error message pops up with "Data type mismatch in criteria expression" and as soon as I click "help" it clears the table. And, the field isn't updated either.

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          Don't put it in the where clause. Use the SELECT statement as a preview of what you want the update to do. For example:

          SELECT file, file_link, Replace([file_link],'\\52qjkl-as-04v\CE_Data\CE\CEC\oce_drawings','F:\CE\CE\CE Drawings') AS NewFile
          FROM JobTicket_024

          There are only 10 types of people in the world, those who understand binary and those who don't.

          T 1 Reply Last reply
          0
          • Z ZurdoDev

            Don't put it in the where clause. Use the SELECT statement as a preview of what you want the update to do. For example:

            SELECT file, file_link, Replace([file_link],'\\52qjkl-as-04v\CE_Data\CE\CEC\oce_drawings','F:\CE\CE\CE Drawings') AS NewFile
            FROM JobTicket_024

            There are only 10 types of people in the world, those who understand binary and those who don't.

            T Offline
            T Offline
            turnerdavid
            wrote on last edited by
            #5

            Thanks RyanDev, but still a no go. I copy/pasted your code to make sure I did not have any typos. It creates the new column, NewFile, but there were no changes to the resulting data. It just copied the old column to the new column verbatim.

            Z 1 Reply Last reply
            0
            • T turnerdavid

              Thanks RyanDev, but still a no go. I copy/pasted your code to make sure I did not have any typos. It creates the new column, NewFile, but there were no changes to the resulting data. It just copied the old column to the new column verbatim.

              Z Offline
              Z Offline
              ZurdoDev
              wrote on last edited by
              #6

              I know there were no changes. It is a SELECT statement, not an update statement. Perhaps run it again and paste some of the results here so we can see.

              There are only 10 types of people in the world, those who understand binary and those who don't.

              T 1 Reply Last reply
              0
              • Z ZurdoDev

                I know there were no changes. It is a SELECT statement, not an update statement. Perhaps run it again and paste some of the results here so we can see.

                There are only 10 types of people in the world, those who understand binary and those who don't.

                T Offline
                T Offline
                turnerdavid
                wrote on last edited by
                #7

                F#*#k There was a typo in my select statement. That's why it wasn't finding anything in the search/select column. Sorry for the troubles. Thanks for helping.

                Z 1 Reply Last reply
                0
                • T turnerdavid

                  F#*#k There was a typo in my select statement. That's why it wasn't finding anything in the search/select column. Sorry for the troubles. Thanks for helping.

                  Z Offline
                  Z Offline
                  ZurdoDev
                  wrote on last edited by
                  #8

                  :-D No problem. Glad you found it.

                  There are only 10 types of people in the world, those who understand binary and those who don't.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups