Syntax of ;" & "password=opps"

I just add a password line and now this does not work.  Just need

;" & "password=opps"
 What would be the right syntax?

Any help would greatly be appreciated!


Public Sub OpenADO()
    Dim dbpath As String
   
    '  dbpath = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb"
   
    dbpath = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb;" & "password=opps"
    Set conn = New ADODB.Connection
    With conn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Open dbpath
    End With
    Set rsShippers = New ADODB.Recordset
    With rsShippers
        .Open "Shippers", conn, adOpenDynamic, adLockOptimistic, adCmdTable
        Cells(2, 2).Value = .Fields(1).Value
        Cells(3, 2).Value = .Fields(2).Value
    End With
   
End Sub
Public Sub CloseADO()
    rsShippers.Close
    Set rsShippers = Nothing
    conn.Close
    Set conn = Nothing
    Cells(2, 2).Value = ""
    Cells(3, 2).Value = ""
End Sub
ca1358Asked:
Who is Participating?

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

x
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.

Éric MoreauSenior .Net ConsultantCommented:
Hi ca1358,

The syntax is for a connection string in ADO is:
"Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"

Cheers!
Bob LambersonSoftware EngineerCommented:
ca1358,
>     dbpath = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb;"
> & "password=opps"
Try
dbpath = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb " & "password='opps'"

Bob
ca1358Author Commented:
dbpath = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb " & "password='opps'"

tried this but got an error" Could not find installable ISAM"

Not sure how to incorpate this statement


"Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"

Any other suggestions would greatly be appreciated!


Éric MoreauSenior .Net ConsultantCommented:
dbpath = "Data Source=C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb;Jet OLEDB:Database Password=opps;"

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
ca1358Author 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 Classic

From novice to tech pro — start learning today.