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. General Programming
  3. Visual Basic
  4. Error, cant update access..?? [modified]

Error, cant update access..?? [modified]

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestionannouncement
12 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.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    I having this error when i run my function,i was thinking to change the value in my access while user click on it but Error message came out..? wat happen? the data i wanna update is either Yes/NO in access. Is it correct 0=NO, 1= yes in vb? Run-time Error '91': object variable or with block variable not set Here is the coding have error: DB.Execute "update dono set InvoicePrint=" & "'" & 1 & "'" & _ " where [NO] = " & "'" & Dorder.dono.Text & "'" -- modified at 5:00 Thursday 10th August, 2006

    D 1 Reply Last reply
    0
    • C campbells

      I having this error when i run my function,i was thinking to change the value in my access while user click on it but Error message came out..? wat happen? the data i wanna update is either Yes/NO in access. Is it correct 0=NO, 1= yes in vb? Run-time Error '91': object variable or with block variable not set Here is the coding have error: DB.Execute "update dono set InvoicePrint=" & "'" & 1 & "'" & _ " where [NO] = " & "'" & Dorder.dono.Text & "'" -- modified at 5:00 Thursday 10th August, 2006

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Use a boolean variable and assign it "True" or "False" as necessary.

      C 1 Reply Last reply
      0
      • D Dave Sexton

        Use a boolean variable and assign it "True" or "False" as necessary.

        C Offline
        C Offline
        campbells
        wrote on last edited by
        #3

        I have edit it but the same error pop up..?? Dim tick as boolean If answer = vbYes Then tick = True DB.Execute "update dono set InvoicePrint=" & " tick " & _ " where [NO] = " & "'" & Dorder.dono.Text & "'" Any mistake ?

        A 1 Reply Last reply
        0
        • C campbells

          I have edit it but the same error pop up..?? Dim tick as boolean If answer = vbYes Then tick = True DB.Execute "update dono set InvoicePrint=" & " tick " & _ " where [NO] = " & "'" & Dorder.dono.Text & "'" Any mistake ?

          A Offline
          A Offline
          Agus Budianto
          wrote on last edited by
          #4

          i think you should try this ;)

          dim tick as string
          if answer=vbyes then
          tick = "true"
          db.execute "UPDATE Dono SET InvoicePrint = " & tick & " WHERE [NO] = "'" & dorder.dono.text & "'"

          mr_a_ghost@yahoo.com

          C 1 Reply Last reply
          0
          • A Agus Budianto

            i think you should try this ;)

            dim tick as string
            if answer=vbyes then
            tick = "true"
            db.execute "UPDATE Dono SET InvoicePrint = " & tick & " WHERE [NO] = "'" & dorder.dono.text & "'"

            mr_a_ghost@yahoo.com

            C Offline
            C Offline
            campbells
            wrote on last edited by
            #5

            i try it..not working... still having the same error......:confused::confused:

            A 1 Reply Last reply
            0
            • C campbells

              i try it..not working... still having the same error......:confused::confused:

              A Offline
              A Offline
              Agus Budianto
              wrote on last edited by
              #6

              usually that error raise because of we forget declaring new instance of an object in vb6 try this

              ...
              dim DB as new adodb.connection, tick as string
              if answer=vbyes then
              tick="True"
              db.connectionstring="provider=microsoft.jet.oledb.4.0;data source=c:\db1.mdb"
              db.open
              db.execute "UPDATE Dono SET InvoicePrint = " & tick & " WHERE [NO] = "'" & dorder.dono.text & "'"
              end if
              end sub

              C 1 Reply Last reply
              0
              • A Agus Budianto

                usually that error raise because of we forget declaring new instance of an object in vb6 try this

                ...
                dim DB as new adodb.connection, tick as string
                if answer=vbyes then
                tick="True"
                db.connectionstring="provider=microsoft.jet.oledb.4.0;data source=c:\db1.mdb"
                db.open
                db.execute "UPDATE Dono SET InvoicePrint = " & tick & " WHERE [NO] = "'" & dorder.dono.text & "'"
                end if
                end sub

                C Offline
                C Offline
                campbells
                wrote on last edited by
                #7

                There is error: Run time error'3704': Operation is not allowed when the object is closed. DB.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=c:\db1.mdb" DB.opendb -- modified at 23:51 Thursday 17th August, 2006

                A 1 Reply Last reply
                0
                • C campbells

                  There is error: Run time error'3704': Operation is not allowed when the object is closed. DB.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=c:\db1.mdb" DB.opendb -- modified at 23:51 Thursday 17th August, 2006

                  A Offline
                  A Offline
                  Agus Budianto
                  wrote on last edited by
                  #8

                  ups, my mistake, you should replace c:\db1.mdb with your database location, and you should use db.open instead of db.opendb methods, good luck:doh:

                  C 1 Reply Last reply
                  0
                  • A Agus Budianto

                    ups, my mistake, you should replace c:\db1.mdb with your database location, and you should use db.open instead of db.opendb methods, good luck:doh:

                    C Offline
                    C Offline
                    campbells
                    wrote on last edited by
                    #9

                    oh yes i did try that but when it run it said the "data type mismatch in criteria expression" is it the value problem?? actually do u know wat is BIT stand for? i check on the data type for the check box in access is in YES/NO (BIT). normally others is Char/ interger wat is BIT?

                    A 1 Reply Last reply
                    0
                    • C campbells

                      oh yes i did try that but when it run it said the "data type mismatch in criteria expression" is it the value problem?? actually do u know wat is BIT stand for? i check on the data type for the check box in access is in YES/NO (BIT). normally others is Char/ interger wat is BIT?

                      A Offline
                      A Offline
                      Agus Budianto
                      wrote on last edited by
                      #10

                      a bit type, is more like a boolean in vb6, it can contain 0 or 1, 0 means false, 1 means true. if you try to update a field of type bit you should use 0 or 1 as value, for example:

                      UPDATE tablename SET Field2 = 0 WHERE Field1 = 0

                      if you try to update a field called "Field2" where the criteria is Field1 of type BIT.

                      C 1 Reply Last reply
                      0
                      • A Agus Budianto

                        a bit type, is more like a boolean in vb6, it can contain 0 or 1, 0 means false, 1 means true. if you try to update a field of type bit you should use 0 or 1 as value, for example:

                        UPDATE tablename SET Field2 = 0 WHERE Field1 = 0

                        if you try to update a field called "Field2" where the criteria is Field1 of type BIT.

                        C Offline
                        C Offline
                        campbells
                        wrote on last edited by
                        #11

                        i solve my problem!!!! the value should be -1 for true and 0 for false, spend so much time on discover it. never wonder true is -1

                        A 1 Reply Last reply
                        0
                        • C campbells

                          i solve my problem!!!! the value should be -1 for true and 0 for false, spend so much time on discover it. never wonder true is -1

                          A Offline
                          A Offline
                          Agus Budianto
                          wrote on last edited by
                          #12

                          well, congratulation then....:-D

                          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