I use a database connection string as below and my program work fine.
Public Function initdb()
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\Masterfile.mdb")
Set rs = db.OpenRecordset("Detail", dbOpenTable)
max = rs.RecordCount
Exit Function
End Function
***********************************
But now I lock the msaccess table ie. Masterfile.mdb with password in order to prevent anyone opening the table and change data inside not through the program, how do I change the connection string so that my code would still work with the protected database.
Any help or suggestion would be highly appreciated.
I am not sure about the DAO version stuff, what i know is that I use ms access 2002, Office XP, does this help ? like i mention before i need to lock the access table so that the table can only be open through the program. I can lock the database with password, but how do I change/modify the code to open the access table.
Last edited by zela; May 7th, 2009 at 6:54 am. Reason: add word
'add Microsoft DAO 3.5 in the project from Reference
Dim myDb as Database
Dim mySet as Recordset
'write in Form Load event
Set myDB=Open Database("Path of the .mdb")
Set Myset=myDb.Open Recordset("TableName",dbopendynaset)
' if you want to display in some text box
TextBox1.text=mySet.Field(0)
TextBox2.Text=mySet.Field(1)
' and so on.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline:downloading