Snytax for password

Could you please tell me the Correct snytax for the password statement.  Using two different statements.  


1.

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
        "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;" & "Password=Opps;"

2.
Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb") & "Password=OPPs;"

Thank you!!!
ca1358Asked:
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.

ptan218Commented:
1. cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
        "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;" & "pwd=Opps;"

2. Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb") & "pwd=OPPs;"
0
Naveen SwamyYash Infinite Solutions Private LimitedCommented:
0
Ved Prakash AgrawalDatabase Consultant/Performance ArchitectCommented:

Dim cn as new adodb.connection

1.
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
        "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;Pwd=Opps;"

2.
Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;Pwd=Opps;")
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Leo EikelmanDirector, IT and Business DevelopmentCommented:
you can do this a few ways

I think this is a better method personally.  It's easier to read.

Dim cn As New ADODB.Connection
cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cn.ConnectionString = "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb"
cn.Properties("Jet OLEDB:Database Password") = "Opps"
cn.Open

If you wanted to do it your way it is

1. cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
        "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;" & "OLEDB:Database Password=Opps"

2.  Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;pwd=OPPs;")


Cheers,

Leo
0

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
GrahamSkanRetiredCommented:
I've paid VAT. I've paid Income tax. I've paid the sin tax. I'm buggered if I now have to pay the sny tax. ;)
0
ca1358Author Commented:
thank you!
0
GrahamSkanRetiredCommented:
You're welcome :)
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.