We help IT Professionals succeed at work.

VBA error '3251'

Last Modified: 2013-12-11
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?

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")
            Set rsRM00101 = Nothing
            cmdRM00101.CommandText = "INSERT INTO " & lInterCompanyID & ".dbo.RM41101 "
            .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
        End With

Open in new window

Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.