ERROR 3705 - Operation is not allowed when the object is open

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikas1111
    New Member
    • Feb 2008
    • 122

    ERROR 3705 - Operation is not allowed when the object is open

    Hi All....

    I have created a form in which i call other forms from the main form ..
    When i click a perticular botton twice there is an error .. Can anyone help me to solve my problem.. The error is:::
    ERROR 3705
    "Operation is not allowed when the object is open"...

    Here i am l posting the code so that you all may get some idea...




    Private Sub cmd_companyinfo _Click()
    Load FrmCompany
    FrmCompany.Show
    End Sub

    Private Sub cmd_duplicate_r eceipt_Click()
    Load FrmDuplicate_Re ceipt
    FrmDuplicate_Re ceipt.Show
    End Sub

    Private Sub cmd_exit_Click( )
    Unload FrmMain
    End
    End Sub

    Private Sub cmd_generate_Cl ick()
    Load FrmReceipt
    FrmReceipt.Show
    End Sub

    Private Sub cmd_receipt_Cli ck()
    Load FrmReceipt_Deta ils
    FrmReceipt_Deta ils.Show
    End Sub

    Private Sub cmd_reset_Click ()
    Load FrmReset
    FrmReset.Show
    End Sub


    Private Sub Form_Load()

    End Sub
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Before Opening a Recordset , you need to check the State of the RecordSet. If not Closed, then Close it. Same Applies to Connection Object also

    if rst.State <> adStateClosed then rst.Close
    if Conn.State <> adStateClosed then Conn.Close

    Regards
    Veena

    Comment

    • lotus18
      Contributor
      • Nov 2007
      • 865

      #3
      Originally posted by vikas1111
      Hi All....

      I have created a form in which i call other forms from the main form ..
      When i click a perticular botton twice there is an error .. Can anyone help me to solve my problem.. The error is:::
      ERROR 3705
      "Operation is not allowed when the object is open"...

      Here i am l posting the code so that you all may get some idea...

      [CODE=vb] Private Sub cmd_companyinfo _Click()
      Load FrmCompany
      FrmCompany.Show
      End Sub

      Private Sub cmd_duplicate_r eceipt_Click()
      Load FrmDuplicate_Re ceipt
      FrmDuplicate_Re ceipt.Show
      End Sub

      Private Sub cmd_exit_Click( )
      Unload FrmMain
      End
      End Sub

      Private Sub cmd_generate_Cl ick()
      Load FrmReceipt
      FrmReceipt.Show
      End Sub

      Private Sub cmd_receipt_Cli ck()
      Load FrmReceipt_Deta ils
      FrmReceipt_Deta ils.Show
      End Sub

      Private Sub cmd_reset_Click ()
      Load FrmReset
      FrmReset.Show
      End Sub


      Private Sub Form_Load()

      End Sub[/CODE]
      Remove

      [CODE=vb]Load <frmName>[/CODE]

      You can only do this once. Maybe you place it on your splash screen if you have. ^ ^

      Comment

      • vikas1111
        New Member
        • Feb 2008
        • 122

        #4
        Originally posted by lotus18
        Remove

        [CODE=vb]Load <frmName>[/CODE]

        You can only do this once. Maybe you place it on your splash screen if you have. ^ ^

        Hi
        Well for some options its working properly and for some options there is error..I will check it out .. Thanks to both for replying...Have a great week end...

        Comment

        • lotus18
          Contributor
          • Nov 2007
          • 865

          #5
          Originally posted by vikas1111
          Hi
          Well for some options its working properly and for some options there is error..I will check it out .. Thanks to both for replying...Have a great week end...
          OK. I think Veena is right. I didn't notice that your program handles database. I'm not really sure for my previous post. Good Luck ^ ^

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            You don't need to explicitly load the form anyway. As soon as you reference any controls or properties of the form, or Show it, it will be loaded automatically.

            Comment

            • vikas1111
              New Member
              • Feb 2008
              • 122

              #7
              Originally posted by QVeen72
              Hi,

              Before Opening a Recordset , you need to check the State of the RecordSet. If not Closed, then Close it. Same Applies to Connection Object also

              if rst.State <> adStateClosed then rst.Close
              if Conn.State <> adStateClosed then Conn.Close

              Regards
              Veena


              Hi Veena
              Thanks the error which i had mentioned is solved ....

              Comment

              • vikas1111
                New Member
                • Feb 2008
                • 122

                #8
                Originally posted by Killer42
                You don't need to explicitly load the form anyway. As soon as you reference any controls or properties of the form, or Show it, it will be loaded automatically.

                Ok now i am using only show... no load...

                Comment

                Working...