MS Access table connection problem

Reply

Join Date: Apr 2007
Posts: 5
Reputation: zela is an unknown quantity at this point 
Solved Threads: 0
zela zela is offline Offline
Newbie Poster

MS Access table connection problem

 
0
  #1
May 6th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 810
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: MS Access table connection problem

 
0
  #2
May 6th, 2009
What version of DAO are you using?
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 5
Reputation: zela is an unknown quantity at this point 
Solved Threads: 0
zela zela is offline Offline
Newbie Poster

Re: MS Access table connection problem

 
0
  #3
May 7th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: MS Access table connection problem

 
0
  #4
May 7th, 2009
Hi,

Open your Database like this :

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

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 6
Reputation: jackVB is an unknown quantity at this point 
Solved Threads: 0
jackVB jackVB is offline Offline
Newbie Poster

Re: MS Access table connection problem

 
0
  #5
May 7th, 2009
'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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 5
Reputation: zela is an unknown quantity at this point 
Solved Threads: 0
zela zela is offline Offline
Newbie Poster

Re: MS Access table connection problem

 
0
  #6
May 11th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC