How do i create a database(.mdb) file at run time with a password?Any one please give me the code.Also,how am i supposed to access that file?-i know to open a .mdb file without a password.
Creating a database at run time
Collapse
X
-
hi
simple way is to keep blank database for the purpose. when you need new database then copy it to the location where you want it. i dont know whether database can be cereated at runtime but tables can be created in an existing database. i can submit the code to create tables two or three days after today.
regards
manpreet singh dhillon hoshiarpur -
pleae try this sampleOriginally posted by vdraceilHow to open that password protected database by code?
[code=vb]
oConn.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=c:\somep ath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPa ssword", _
"myUsername ", "myPassword "
[/code]Comment
-
Place a button on a form called "Command1"
Dim DB As Database
Private Sub Command1_Click( )
'1) Create DataBase name "Names" using DAO
Set DB = CreateDatabase( App.Path & "\Names", dbLangGeneral, dbEncrypt)
'2) Create Tables and Fields (rename Table and fields as needed) using DAO
' and the Microsoft Jet SQL
DB.Execute "CREATE TABLE Table1 " & "(First CHAR (50), Last CHAR (50), Age INT, Other Info NOTE);"
'3) Create Password
DB.NewPassword "", "MyPassword "
DB.Close 'This Line is Optional
MsgBox "DataBase Created."
End
End SubComment
Comment