943,600 Members | Top Members by Rank

Ad:
May 6th, 2009
0

MS Access table connection problem

Expand Post »
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.

Zela
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zela is offline Offline
10 posts
since Apr 2007
May 6th, 2009
0

Re: MS Access table connection problem

What version of DAO are you using?
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
May 7th, 2009
0

Re: MS Access table connection problem

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zela is offline Offline
10 posts
since Apr 2007
May 7th, 2009
0

Re: MS Access table connection problem

Hi,

Open your Database like this :

Set db = ws.OpenDatabase(App.Path & "\Masterfile.mdb", False, False, ";pwd=MyPassword")

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
May 7th, 2009
0

Re: MS Access table connection problem

'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.

Eidt
mySet.Edit
myset(0)=TextBox1.Text
myset(1)=TextBox2.Text
mySet.Update
mesgbox("Record Updated")

Try this, it may helps you
Last edited by jackVB; May 7th, 2009 at 7:18 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jackVB is offline Offline
6 posts
since Dec 2008
May 11th, 2009
0

Re: MS Access table connection problem

Hi Veena,

It sure works now, thanks for your line. Now I can protect the msacess table with the password.

Zela
Last edited by zela; May 11th, 2009 at 2:06 am. Reason: addition of text
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zela is offline Offline
10 posts
since Apr 2007

This thread is more than three months old

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.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: downloading
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Update Binary Field in sql server 2000





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC