error during update method
Im adding a record using the addnew method but when it reached the update method this error appeared,
"Connection is busy with results for another command". What is the cause of this problem?
This is my code:
Code:
Do While Not rst.EOF ''' this is tblinv_det
‘’’’some more codes here
Set rstCrdLimit = cnn.Execute(mCrdLimit)
mRTotal = (IIf(IsNull(rstCrdlimit!amount), 0, rstCrdlimit!amount) + rst!orders )
If rst!acct_no <> invalidacctno Then
Set rstcustomer = cnn.Execute("select * from customer where acct_no ='" & mAcctNo & "'")
If rstcustomer.EOF Then
mContact = rst!contactname
mNAME = rst!customername
mSTATE = rst!stete
mPostal = rst!postal
Else
mContact = rstcustomer!contactname
mNAME = rstcustomer!customername
mSTATE = rstcustomer!address1 & " " & rstcustomer!address2
mPostal = rstcustomer!postal
mCity = rstcustomer!city
End If
Else
mContact = rst!contactname
mNAME = rst!customername
mSTATE = rst!state
mPostal = rst!postal
mCity = rst!city
End If
With Invoice '''' this is the tblinv_head
.AddNew
!ac_no = mAcctNo
!inv_no = mInvoice
!inv_Date = Date
.Update <<====== this is where the error
End With
cnn.Execute ("update tblinv_det set field1= ......" )
cnn.Execute ("update tblinv_head set field1 = ....... ")
rst.MoveNext
Loop