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. operation not allowed when object is closed

operation not allowed when object is closed

Scheduled Pinned Locked Moved Visual Basic
questionhelp
2 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.
  • M Offline
    M Offline
    mcm
    wrote on last edited by
    #1

    uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, UnitPrice, FullPrice) Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & "," & iPrice & ", " & iFullPrice & ")" Set RS = Conn.Execute(uSQL) 'MsgBox ("Adding record to the datagrid") 'refreshing the datagrid based on new info RS.Requery Me.Adodc3.Refresh Me.DataGrid2.Refresh the above is code for adding data to a datagrid. the Adodc3's recordset is the table OrderDetails2 and the datasource of the datagrid is Adodc3. However, when executed, it throws the above error - i have run the code many times before and it has never thrown this error. what is the problem? if it is referring to the RS, how do i open this to stop the error occurring?

    H 1 Reply Last reply
    0
    • M mcm

      uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, UnitPrice, FullPrice) Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & "," & iPrice & ", " & iFullPrice & ")" Set RS = Conn.Execute(uSQL) 'MsgBox ("Adding record to the datagrid") 'refreshing the datagrid based on new info RS.Requery Me.Adodc3.Refresh Me.DataGrid2.Refresh the above is code for adding data to a datagrid. the Adodc3's recordset is the table OrderDetails2 and the datasource of the datagrid is Adodc3. However, when executed, it throws the above error - i have run the code many times before and it has never thrown this error. what is the problem? if it is referring to the RS, how do i open this to stop the error occurring?

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      this mat be the problem Set RS = Conn.Execute(uSQL) you need to call Conn.Open

      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