jdr0606
asked on
VBA error '3251'
We recently upgraded from Great Plains 7.5 to Great Plains 9.0 and SQL2000 to SQL2005.
One of the VBA packages is now giving me a '3251' error at the .AddNew line.
(Run-time error '3251'
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.)
I have attached a sample snippet of the code.
Any ideas?
One of the VBA packages is now giving me a '3251' error at the .AddNew line.
(Run-time error '3251'
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.)
I have attached a sample snippet of the code.
Any ideas?
If valid_number = True Then
With rs
If newcustomer Then
Dim cmdRM00101 As ADODB.Command
Dim CustClass As String
Dim rsRM00101 As ADODB.Recordset
Set cmdRM00101 = New ADODB.Command
cmdRM00101.ActiveConnection = adoChange
cmdRM00101.CommandType = adCmdText
cmdRM00101.CommandText = "Select * from " & lInterCompanyID & ".dbo.RM00101 where CUSTNMBR = '" & Trim(TextBoxCustNum.Text) & "'"
Set rsRM00101 = cmdRM00101.Execute
CustClass = chknull(Trim(rsRM00101.Fields("CUSTCLAS").value), "S")
rsRM00101.Close
Set rsRM00101 = Nothing
cmdRM00101.CommandText = "INSERT INTO " & lInterCompanyID & ".dbo.RM41101 "
.AddNew
.Fields(0).value = Trim(TextBoxCustNum.Text)
.Fields(1).value = CustClass 'custclass - get from rm00101
.Fields(2).value = ""
.Fields(15).value = "" 'crcode?
End If
.Fields(3).value = txtPercent1.Text
.Fields(4).value = txtPercent2.Text
.Fields(5).value = txtPercent3.Text
.Fields(6).value = txtPercent4.Text
'.Fields(7).value = txtPercent5.Text
'.Fields(8).value = txtPercent6.Text
.Fields(9).value = transAction(cboAction1.Text)
.Fields(10).value = transAction(cboAction2.Text)
.Fields(11).value = transAction(cboAction3.Text)
.Fields(12).value = transAction(cboAction4.Text)
'.Fields(13).value = transAction(cboAction5.Text)
'.Fields(14).value = transAction(cboAction6.Text)
'set ordstatus field - cboAction.text should not be empty
Select Case cboAction.Text
Case "Use Table below"
.Fields(16).value = "0"
Case "Always Place On Credit Review"
.Fields(16).value = "1"
Case "Always Place On Credit Hold"
.Fields(16).value = "2"
Case "Never Allow Orders to be Taken"
.Fields(16).value = "2" 'was 3 - se 092903
Case "Never Place on Credit Review or Hold"
.Fields(16).value = "0" 'was 4 - se 092903
Case ""
.Fields(16).value = ""
End Select
.Update
.Close
End With
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.