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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Table does not update record in MS ACCESS

Table does not update record in MS ACCESS

Scheduled Pinned Locked Moved Visual Basic
databasehelpannouncement
6 Posts 3 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
    Tufail Ahmad
    wrote on last edited by
    #1

    i use VB 6.0 with MS Access as a database. With the insertion in table1 i use to update a counter (N+1, ....) in table2. but some time table2 does not update its value and repeat the previous value. e.g if previous value is 2854 then it should be updated to 2855 Help please

    L 1 Reply Last reply
    0
    • T Tufail Ahmad

      i use VB 6.0 with MS Access as a database. With the insertion in table1 i use to update a counter (N+1, ....) in table2. but some time table2 does not update its value and repeat the previous value. e.g if previous value is 2854 then it should be updated to 2855 Help please

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It would be difficult to answer your question without looking into your code.

      T 1 Reply Last reply
      0
      • L Lost User

        It would be difficult to answer your question without looking into your code.

        T Offline
        T Offline
        Tufail Ahmad
        wrote on last edited by
        #3

        Code is very simple and i know how to code for insertion into database. str="Update table2 set field1=val1, field2=val2 Where condition" set rs=cn.execute(str) but some time it misses to update a record.

        L D 3 Replies Last reply
        0
        • T Tufail Ahmad

          Code is very simple and i know how to code for insertion into database. str="Update table2 set field1=val1, field2=val2 Where condition" set rs=cn.execute(str) but some time it misses to update a record.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Change your number-field to an auto-numbering field[^]. That way the number will increase itself, every time that you insert a table - without the need to track the highest number in a separate table.

          I are Troll :suss:

          1 Reply Last reply
          0
          • T Tufail Ahmad

            Code is very simple and i know how to code for insertion into database. str="Update table2 set field1=val1, field2=val2 Where condition" set rs=cn.execute(str) but some time it misses to update a record.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            You should be using autonumbering fields for your primary keys. Also, when you insert a record into Table1, you need to retrieve the ID that record got in the table, then use that ID in your query to update Table2.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            1 Reply Last reply
            0
            • T Tufail Ahmad

              Code is very simple and i know how to code for insertion into database. str="Update table2 set field1=val1, field2=val2 Where condition" set rs=cn.execute(str) but some time it misses to update a record.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Tufail Ahmad wrote:

              Update table2 set field1=val1, field2=val2 Where condition

              This code will NOT insert anything into table2, ever wondered why ?

              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