Convert from Access VBA to 2010

How to convert this VBA code to

Dim xlObj As Object
            Dim rs As DAO.Recordset

            Dim rs1 As DAO.Recordset

            Dim shtCnt As Integer
            Dim j As Integer

            Dim strCommandName As String

            strCommandName = "cmdRunBench"

            myDSrs = New DataSet()
            myDSrs = GetDataSet("MainHeader", "myTable")

            xlObj = CreateObject("excel.application")
            With xlObj
                .Visible = True
                shtCnt = .Worksheets.Count
                    myDSrs1 = New DataSet()
                    myDSrs1 = GetDataSet("Select * from MainDetails where IDNo=" & myDRrs("IDNo"), "myTable")

Open in new window

I really appreciate your help.
Queennie LAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
That looks like a hodge-podge between VBA and some .NET stuff (the Dataset is a commonly used Object in .NET).

In .NET, "Recordsets" would become either a Dataset or perhaps a DataTable (or something along those lines, depending on exactly what you need to do with it). You'd typically use a Command object to load those things, and your Command object would need some form of Connection objects. I often do this to fill a Datatable:

Using con As New SQLConnection
  con.ConnectionString = "blah blah"
  Using cmd As New SQLCommand
    cmd.Connection = con
    cmd.CommandText = "SELECT * FROM SomeTable"
    Using dt As New Datatable
      '/ dt is loaded and ready for use
    End Using
  End Using
End Using

As far as the Excel stuff, you'd typically need to use the Interops assembly for that:

The Interops would have to be installed and available on your development machine, as well as any machine where your program will be used.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Queennie LAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.