Link to home
Start Free TrialLog in
Avatar of infoserver
infoserver

asked on

To protect MSAccess file

Using the below ADO codeing to connect MSAceess , I want to give password to MSAccess file to  protect unauthorised access from users .
     if I am giveing password to MSAccess file using its security option , I can't connect to MSAccess from VB 6.0 , in the below codeing where can I give password , or I want to change my codeing ..

     Public cn As ADODB.Connection
     Public rs As ADODB.Recordset
     Public cmd As ADODB.Command
 
 Set cn = New ADODB.Connection    
    constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\shalimardbs.mdb;Persist Security Info=false"
    cn.Open constr
   Set cmd = New ADODB.Command
   Set cmd.ActiveConnection = cn

     dc.connect
       dc.cmd.CommandText = "SELECT ITEMNAME,WEIGHT From STOCKREGISTER WHERE ITEMCODE =ANY  (SELECT ITEMCODE FROM PREPARATIONCHART WHERE DISHCODE = 'D001' ) ORDER BY ITEMCODE "
         Set dc.rs = New ADODB.Recordset
         Set dc.rs = dc.cmd.Execute
Avatar of hongjun
hongjun
Flag of Singapore image

Set a Password for an Access Database
http://www.freevbcode.com/ShowCode.Asp?ID=354

hongjun
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slavikn
slavikn

You should set a password to the database and then correct your conncetion-string.

constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\shalimardbs.mdb;Persist Security Info=false;Jet OLEDB:Database Password=yourpasssswordddd"
slavikn,

You are here long enough to know EE policy. The policy here is to post everyhing in comments. Questionner will then have the option to accept a comment as an answer. Posting as a proposed answer will lock the question and thus restrict the exposure to more experts. We know you are new here and thus is forgiven. With the current version of EE, you do not have the option to convert your answer to a comment but this can be done by the questioner himself. I advise the questionner to reject his answer so that this question will be released to more experts. You can however accept his comment again if you find it is really helpful.

Thanks
hongjun
hongjun,

First of all I am very sorry. Secondly, how did you manage to add a comment if it is forbidden?

Best regards,
slavikn.
>>how did you manage to add a comment if it is forbidden
This question is not forbidden. It is just being brought to the Locked state and thus reducing exposure to more experts.

hongjun
if we are using Crystal Report , How can we give the same password to Crystal Report 8.0
Avatar of infoserver

ASKER

if we are using Crystal Report , How can we give the same password to Crystal Report 8.0
if we are using Crystal Report , How can we give the same password to Crystal Report 8.0
if we are using Crystal Report , How can we give the same password to Crystal Report 8.0
Avatar of DanRollins
Hi infoserver,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept hongjun's comment(s) as an answer.

infoserver, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer

Computer101
E-E Admin