Setting database passwod with ADOX 
Author Message
 Setting database passwod with ADOX

Hi!

I'm using ADOX.Catalog to create an Access database from
code (see below). I would also like to set a password to a
database a create - is that possible?

****************************
Private Sub CreateDatabase()

    Dim strConn As String
    Dim objCat As adox.Catalog
    Dim objMyTable As New adox.Table

    strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & _
        App.Path & "\MyDatabase.mdb"
    Set objCat = New adox.Catalog

    objCat.Create strConn
    objCat.ActiveConnection = strConn

    With objMyTable
        .Name = "MyTable"
        .Columns.Append "Name", adVarWChar, 20
        .Columns.Append "Address", adVarWChar, 50
        .Columns.Append "City", adVarWChar, 50
        .Columns.Append "ST", adVarWChar, 20
        .Columns.Append "PostalCode", adVarWChar, 20
        .Keys.Append "PrimaryKey", adKeyPrimary, "Name"
    End With
    objCat.Tables.Append objMyTable

    Set objMyTable = Nothing
    Set objCat = Nothing
End Sub
****************************

Thanks,
Bostjan



Sat, 23 Jul 2005 18:40:50 GMT  
 Setting database passwod with ADOX
Please check this article to see if it helps.

HOW TO: How to Use ADOX to Change Jet User Passwords in Access
http://support.microsoft.com/default.aspx?scid=KB;EN-US;304319

Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provide "AS IS" with no warranties, and confers no rights.

--------------------
Content-Class: urn:content-classes:message


X-Tomcat-NG: microsoft.public.vb.database.ado

Hi!

I'm using ADOX.Catalog to create an Access database from
code (see below). I would also like to set a password to a
database a create - is that possible?

****************************
Private Sub CreateDatabase()

    Dim strConn As String
    Dim objCat As adox.Catalog
    Dim objMyTable As New adox.Table

    strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & _
        App.Path & "\MyDatabase.mdb"
    Set objCat = New adox.Catalog

    objCat.Create strConn
    objCat.ActiveConnection = strConn

    With objMyTable
        .Name = "MyTable"
        .Columns.Append "Name", adVarWChar, 20
        .Columns.Append "Address", adVarWChar, 50
        .Columns.Append "City", adVarWChar, 50
        .Columns.Append "ST", adVarWChar, 20
        .Columns.Append "PostalCode", adVarWChar, 20
        .Keys.Append "PrimaryKey", adKeyPrimary, "Name"
    End With
    objCat.Tables.Append objMyTable

    Set objMyTable = Nothing
    Set objCat = Nothing
End Sub
****************************

Thanks,
Bostjan



Sun, 24 Jul 2005 14:48:46 GMT  
 Setting database passwod with ADOX
Hi Alick,
Thanks for the pointer on adding passwords. I had the same question.
But I can not get the following code to work. Can someone advise what
I am doing wrong? The table gets created and I can open it with a
connection but I get error 3251 when trying to append the user.

 All I really want to do is password protect the table so my program
(and I, of course)  can open it. The user name is not really important
to me or the application.

Dim cat As New ADOX.Catalog
Dim dbTest As New ADODB.Connection
Dim testUser As New ADOX.User

' test code to create an empty Access table with password protection
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\jltestado.mdb;Jet OLEDB:Engine Type=5;"
testUser.Name = "John"
testUser.ChangePassword "", "marymonte"
cat.Users.Append testUser

TIA,
John Lee


Quote:

>Please check this article to see if it helps.

>HOW TO: How to Use ADOX to Change Jet User Passwords in Access
>http://support.microsoft.com/default.aspx?scid=KB;EN-US;304319

>Sincerely,

>Alick Ye, MCSD
>Product Support Services
>Microsoft Corporation
>Get Secure! - <www.microsoft.com/security>

>This posting is provide "AS IS" with no warranties, and confers no rights.

>--------------------
>Content-Class: urn:content-classes:message


>X-Tomcat-NG: microsoft.public.vb.database.ado

>Hi!

>I'm using ADOX.Catalog to create an Access database from
>code (see below). I would also like to set a password to a
>database a create - is that possible?

>****************************
>Private Sub CreateDatabase()

>    Dim strConn As String
>    Dim objCat As adox.Catalog
>    Dim objMyTable As New adox.Table

>    strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
>Source=" & _
>        App.Path & "\MyDatabase.mdb"
>    Set objCat = New adox.Catalog

>    objCat.Create strConn
>    objCat.ActiveConnection = strConn

>    With objMyTable
>        .Name = "MyTable"
>        .Columns.Append "Name", adVarWChar, 20
>        .Columns.Append "Address", adVarWChar, 50
>        .Columns.Append "City", adVarWChar, 50
>        .Columns.Append "ST", adVarWChar, 20
>        .Columns.Append "PostalCode", adVarWChar, 20
>        .Keys.Append "PrimaryKey", adKeyPrimary, "Name"
>    End With
>    objCat.Tables.Append objMyTable

>    Set objMyTable = Nothing
>    Set objCat = Nothing
>End Sub
>****************************

>Thanks,
>Bostjan



Tue, 26 Jul 2005 01:11:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to set the required property in access databases via adox

2. ADOX: help with setting autonumber column

3. How to set Format property in ACCESS2k thru ADOX using JET OLEDB 4.0 provider

4. ADOX, Access 2000 and Jet OLEDB property settings

5. Setting a column's default value with ADOX

6. Set Default Property of Column Object Using ADOX

7. ADOX: Jet Oledb 4.0: How to set Format property for a column

8. Creating MDB using ADOX and setting column to NOT required

9. Setting Required to False in MDB viq ADOX

10. ADOX/Access2000 How can I get opr set the description of a table

11. Cannot set any ADOX Properties

12. ADOX.Indexes/ADOX.Key/Foreign Keys

 

 
Powered by phpBB® Forum Software