Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

VBA, ADO, and GP2010...Sample of updating a deleting SQL records needed for code upgrade.

Posted on by Microsoft Employee

I am upgrading some VBA code to GP2010 and need to upgrade the syntax for ADO. All of that was going fine until I hit the "update" code. I cannot find any samples or instructions for doing the following and everything still compiles. I know I can build up a text command but that seems like a big step backwards. Below is the old way which worked, does anybody know how or have a sample with the new method?

I bomb on the rst.AddNew line.

            rst.AddNew

           'rst("ITEMNMBR") = AlternateItems.ItemNumber.Value

           rst!ITEMNMBR = AlternateItems.ItemNumber.Value

           'rst("ALTPART_I") = AltPart.Value

           rst!ALTPART_I = AltPart.Value

           'rst("Exclude") = Exclude.Value

           rst!Exclude = Exclude.Value

           rst.Update

*This post is locked for comments

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: VBA, ADO, and GP2010...Sample of updating a deleting SQL records needed for code upgrade.

    What error it throw?

  • Bryan Prince Profile Picture
    Bryan Prince 660 on at
    RE: VBA, ADO, and GP2010...Sample of updating a deleting SQL records needed for code upgrade.

    Hi Jon,

    AddNew is still the proper method to use in order to create a new record in Dynamics GP 2010.

    Perhaps there is a separate issue? Are you sure you opened the recordset properly? If you could post a complete code sample reproducing the issue we could look into it further.

    Bryan Prince

    Straight Arrow Consulting, Inc.

    (615) 337-9248

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans