Equivalent ADO

How to Convert my DAO to ADO?
I am using VB6 with MS Access

Dim db as database
Dim rs as recordset

set db = opendatabas("D:\Inventory.mdb")
set rs = db.openrecordset("Item")

with rs
 !itemno = text1.text
 !itemname = text2.text
end with
Who is Participating?
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.


This should do it:

Sub AdoTest()
  Dim cn As New ADODB.Connection
  Dim rs As New ADODB.Recordset
  cn.Provider = "Microsoft.Jet.OLEDB.4.0"
  cn.Open "D:\Inventory.mdb"
  rs.Open "Item", cn, adOpenDynamic, adLockOptimistic
  With rs
    .Fields("itemno").Value = Text1.Text
    .Fields("itemname").Value = Text2.Text
  End With
End Sub

Ture Magnusson
Karlstad, Sweden

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
Hey, Ackid32 !!, ¿why don't you pay your older questions first, before going on asking new ones?

Question #10238493 is waiting for your payment since Nov 25th.

ackid32Author Commented:
but it says "no connection provider" message why?
you're kidding, ah?
Clap !!! :)
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 Classic

From novice to tech pro — start learning today.