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.OL EDB.4.0;Da ta 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
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.OL
Then i tried this line and it did not work
Call tmpUser.ChangePassword("",
I think it has to do with opening the db thru vb in exclusive mode
thanx allot
Craig
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanx guys i will give it a bash
:)
Craig
:)
Craig
ASKER
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
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
ASKER
Great thanx again
Read this article : http://support.microsoft.com/support/kb/articles/Q252/9/08.ASP
ASKER
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
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