[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Syntax of ;" & "password=opps"

Posted on 2006-04-14
5
Medium Priority
?
188 Views
Last Modified: 2010-05-01
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
0
Comment
Question by:ca1358
  • 2
  • 2
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16456331
Hi ca1358,

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

Cheers!
0
 
LVL 12

Expert Comment

by:Bob Lamberson
ID: 16456365
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
0
 

Author Comment

by:ca1358
ID: 16456413
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!


0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 16456424
dbpath = "Data Source=C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb;Jet OLEDB:Database Password=opps;"
0
 

Author Comment

by:ca1358
ID: 16456449
Thank you!!!!!!!!!!!!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question