Link to home
Start Free TrialLog in
Avatar of CraigLazar
CraigLazar

asked on

Set Password and create tbl from vb

Hi
I have this code which i am using to create a access2000 database. It works well except i
now need to create it and set the password up and then i need to create a table in the database.
So i have the first part working to create the db file. This is the code i am using to create it
    Dim catTmp As New ADOX.Catalog
    Dim tmpUser As New ADOX.User
    ' Delete the database if it exists
    On Error Resume Next
    Kill strPath
    On Error GoTo PROC_ERR
    ' The Create method of the ADOX.Catalog
    '     object
    ' creates a new database.
    catTmp.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath
   
   
Then i tried this line and it did not work
Call tmpUser.ChangePassword("", "password")

I think it has to do with opening the db thru vb in exclusive mode

thanx allot


Craig

Avatar of Nimbus
Nimbus

Do you know if the PROC_ERR procedure ever gets executed? I have noticed in the past that the kill method takes some time to execute, resulting in errors when the new database is created. To get around that error, a loop was placed in the code using dir to check that the file was truly deleted from the drive prior to creating it again. This may not be the answer to your question.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CraigLazar

ASKER

thanx guys i will give it  a bash

:)

Craig
HI Emoreau
Thanz allot that worked great, one last question if u do not mind - how can i create a table now once the db is created - do u have a sample for me please ?

thanx allot

Craig
Great thanx again
Hi Emoreau
I tired the code in the article but i am getting an eror on this line

>>> Cat.Tables.Append objTable

this is the error
"Object or provider is not capable of performing requested operation"

Do u have an article on maybe copying a table, cause maybe i can create a template table in my main db and then copy it into the newly created db than rather creating a table oin the fly - will be easier to maintian ?

thanx allot for the help - if u want more points for the help let me know

Have a good one

Cheers

Craig