How to fix the error "operation is not allowed when the object is open"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sathia1
    New Member
    • Jun 2010
    • 4

    How to fix the error "operation is not allowed when the object is open"?

    Hello everyone,

    I am using a module in access to write a query. I first opened a connection to my database, and wrote my query in SQL in the module itself, then I have the following codes:

    rs_Recordset.Op en Source:=sql, _
    ActiveConnectio n:=o_Conn, _
    CursorType:=adO penDynamic, _
    LockType:=adLoc kReadOnly

    And I'm not sure why I am getting the error message above. I am thinking that may be I need to make sure something (or the 'object' as Access is refering to it) is closed but I don't know how to do that.

    I would greatly appreciate suggestions. Thanks!
  • romiverma
    New Member
    • Jun 2010
    • 11

    #2
    hi,
    try
    if rs_Recordset.st ate=1 then rs_Recordset.cl ose
    before ur query

    Comment

    Working...