Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: RunTime Error 3705


Message #1 by <herbe@a...> on Tue, 19 Mar 2002 11:13:24 -0500
i believe it is because the recordset object still in open status. 

you may ne can do this:
if rs.state=adstateopen then
	rs.close
end if

-----Original Message-----
From: herbe@a... [mailto:herbe@a...]
Sent: Wednesday, March 20, 2002 12:13 AM
To: professional vb
Subject: [pro_vb] RunTime Error 3705


     I am not sure on what I am doing wrong.
     
     My Goal is to have the user enter the customers Number, and if it is 
     wrong tell the user and have them try again.
     
     But everytime I try it I get this error message:
     
     RunTime Error 3705
     Operations is not allowed when the object is open.
     
     
     Here is the script:
     
     Private Sub cmdSearch_Click()
     
         'On Error GoTo ADODBERROR
         
         If txtStartDate = " " Then
             strstartDate = "12/13/1960"
         Else
             strstartDate = txtStartDate.Text
         End If
         
         If txtDDU <> " " And Len(txtDDU) = 6 Then
             With cmd
                 .ActiveConnection = cnn
                 .CommandText = "spClientsByDDU"
                 .CommandType = adCmdStoredProc
                 .Parameters.Append .CreateParameter("@DDU", adChar,        
                     adParamInput, 6, txtDDU.Text)
                 .Parameters.Append .CreateParameter("@StartDate", adDate,  
                     adParamInput, 10, strstartDate)
                 rst.Open cmd, , adOpenDynamic, adLockReadOnly
             End With
             
             If rst.RecordCount > 0 Then
                 DoSearch
             Else
                 MsgBox "Test"
                 txtDDU.SetFocus
             End If
             
         Else
             If txtDDU = " " Then
                 MsgBox "Test2"
                 txtDDU = " "
                 txtDDU.SetFocus
             ElseIf Len(txtDDU.Text) <> 6 Then
                 MsgBox "Test3"
                 txtDDU = " "
                 txtDDU.SetFocus
             End If
         End If
     
     End Sub



  Return to Index