473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Password protected Access file in VB6

Have password protected a large Access database and when trying to run the program in VB6 am getting following error when trying to run program:

Not a valid account name or password

***** ON LOAD -- SOURE CODE ******
Expand|Select|Wrap|Line Numbers
  1. strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
  2. strSource = "Data Source=" & App.Path & "\MYDATABASE.MDB;UserID=UNKNOWN VALUE;Password=mypassword"
  3. ' Nothing I put into UserID in the above line appears to work
  4. ' If I remove "UserID=" get same error.
  5. Set rstConnRecordset = New ADODB.Connection
  6. strConnectionRecordset = strProvider & strSource & "Persist Security Info=False"
  7.  
  8. rstConnRecordset.Open strConnectionRecordset
  9. ' Am getting error at above line, when running program
  10.  
  11. Set rstRecord = New ADODB.Recordset
  12.  
  13. With rstRecord
  14.     .ActiveConnection = rstConnRecordset
  15.     .CursorLocation = adUseClient
  16.     .CursorType = adOpenKeyset
  17.     .LockType = adLockOptimistic
  18.     .Open "MYFORM"
  19.     ' above line loads one of two database' involved, each called from separate
  20.     ' routines.
  21. End With
  22.  
  23. If Not rstRecord.BOF And Not rstRecord.EOF Then
  24.     rstRecord.Sort = "RecNum ASC"
  25.     rstRecord.Requery
  26.     Set dgRecordNo.DataSource = rstRecord
  27. End If
  28.  
When loading the database in MS Access, it responds to the assigned password correctly.

Any assistance will be most appriciated.
Jan 29 '08 #1
4 5169
9815402440
180 100+
hi
if you want to keep same provider then you need to give system.mdw path
open connection as following:
Expand|Select|Wrap|Line Numbers
  1.     With cn
  2.         .Provider = "Microsoft.Jet.OLEDB.4.0"
  3.         .Properties("Jet OLEDB:System Database") = "C:\Documents and Settings\Manpreet Dhillon\Application Data\Microsoft\Access\system.mdw"
  4.         .Properties("Data Source") = <database path>
  5.         .Properties("Jet OLEDB:Database Password") = <your password>
  6.         .Open
  7.     End With
  8.  
if you want to use system.mdw then you may change provider to msdatashape

as follows
Expand|Select|Wrap|Line Numbers
  1. with cn
  2.                 .Provider = "MsDataShape"
  3.                 .Properties("Data Provider") = "Microsoft.Jet.OLEDB.4.0"
  4.                 .Properties("Data Source") = <database path>
  5.                 .Properties("Extended Properties") = "Jet OLEDB:Database Password= " & <your password>
  6.                 .Open
  7. end with
  8.  
regards
manpreet singh dhillon hoshiarpur
Jan 30 '08 #2
Have password protected a large Access database and when trying to run the program in VB6 am getting following error when trying to run program:

Not a valid account name or password

***** ON LOAD -- SOURE CODE ******

strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
strSource = "Data Source=" & App.Path & "\MYDATABASE.MDB;UserID=UNKNOWN VALUE;Password=mypassword"
' Nothing I put into UserID in the above line appears to work
' If I remove "UserID=" get same error.
Set rstConnRecordset = New ADODB.Connection
strConnectionRecordset = strProvider & strSource & "Persist Security Info=False"

rstConnRecordset.Open strConnectionRecordset
' Am getting error at above line, when running program

Set rstRecord = New ADODB.Recordset

With rstRecord
.ActiveConnection = rstConnRecordset
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "MYFORM"
' above line loads one of two database' involved, each called from separate
' routines.
End With

If Not rstRecord.BOF And Not rstRecord.EOF Then
rstRecord.Sort = "RecNum ASC"
rstRecord.Requery
Set dgRecordNo.DataSource = rstRecord
End If

When loading the database in MS Access, it responds to the assigned password correctly.

Any assistance will be most appriciated.

Hi,
You can try this by this following code:

1. strProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
2. strSource = "Data Source=C:\DB.mdb;Jet OLEDB:Database Password=cse;"


3. strConnectionRecordset = strProvider & strSource


If u get success, plz reply.

Get Better.

Regards,
shuvo2k6
Jan 30 '08 #3
Thank you very much. At least it now does something.

With your modifications, the program displays two (2), "Now a valid password" pop up screens, but then will enter the program. This is more than I have acchived in the past several hours of research. And days of "trial and error" modifications. Just need to get rid of the two pop-ups.

The only change I made was to add the & App.Path feature.

Source code is now:
Expand|Select|Wrap|Line Numbers
  1. strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
  2. strSource = "Data Source=" & App.Path & "\bibleqz.mdb;Jet OLEDB:Database Password=mypassword"
  3.  
  4. Set rstConnRecordset = New ADODB.Connection
  5. strConnectionRecordset = strProvider & strSource
  6. ' removed this portion per your instructions from above line -- & "Persist
  7. ' Security Info=False"
  8. rstConnRecordset.Open strConnectionRecordset
  9. Set rstRecord = New ADODB.Recordset
  10.  
  11. With rstRecord
  12.     .ActiveConnection = rstConnRecordset
  13.     .CursorLocation = adUseClient
  14.     .CursorType = adOpenKeyset
  15.     .LockType = adLockOptimistic
  16.     .Open "Bquiznt"
  17. End With
  18.  
  19. If Not rstRecord.BOF And Not rstRecord.EOF Then
  20.     rstRecord.Sort = "RecNum ASC"
  21.     rstRecord.Requery
  22.     Set dgRecordNo.DataSource = rstRecord
  23.     Call UpdateTextBoxes
  24. End If
  25.  
Just for information sake, I have only been using VB6 for less than 3 months.

The program is a Biblical Quiz, which includes 525 New Testament and 525 Old Teastament questions, with 4 multiple choice answers.

You can switch between New and Old Testament questions at any time.
You can play by yourself or with up to 6 players.
You can select level of dificulty of questions you want to answer.
If you answer the question incorrectly, you get to read the related verse. Or you can read the related verse at any time.
You can "review" any question at any time. (This does upset the scoreing feature)

Again, Thanks for pointing me in the right direction.
Jan 30 '08 #4
******* ISSUE RESOLVED *******

Thanks very much to "shuvo2k6"

Due to the fact that I was in a hurry to try your modifications, I failed to follow up in my source code and due to the fact that I was calling the same basic routine when changing database', once for the New Testament database and once for the Old Testament database, when I first tried your modifications, this caused the two "Not a valid password" issues.

When I updated both locations of calling the databases', it is now working correctly without the "Not a valid password" issues.

Again thank you so much for your interest in others and willingness to help.

As a new programmer in Visual Basic, I have a "LOT" to learn, and if it weren’t for the assistance of people like you, I feel some new programmers, myself included, would give up too early.

Also thanks to those others that offered their assistance, I hope to be able to follow your leads and assist others as I learn more programming techniques.

larystoy
Jan 30 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wm | last post by:
Something just occurred to me... <yeah, I know, it scared me too> I just password-protected a website by including a password authentication script in each page of a private section. The script...
22
by: xmp333 | last post by:
Hi All, I am trying to hide my JavaScript source. The method I chose was to keep all the important source in a password protected folder, and then use a SRC="folder/script.js" to include it...
3
by: MissiMaths | last post by:
I have used outputTo to export a copy of a table out of access into excel. I was wondering if there is anyway to set a password on this within the code so that it is read only in .xls format? I...
0
by: FleaBite | last post by:
Hi, I have developed a web service in PHP using NuSOAP. I want some form of security for this WS, so I've put it in a directory which is password protected, using an htaccess file. The...
4
by: kthiagar | last post by:
Hi I am trying to connect to a password protected access file from VB.NET. I have no problem in connecting to Access, if I remove the password. This is what I am doing: In the server explorer,...
6
by: clusardi2k | last post by:
Hello again, I have to go home and read up on Access. But, I have read else-where in this newsgroup that I can just save the password in the database under scrutiny. Wouldn't it be wasteful...
5
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. ...
4
by: prophet | last post by:
so hopefully only one more question about this..... so I have a webpage using frames. I have a header and a column down the left, and the main body (all of which have different htmls but are...
3
by: Noel S Pamfree | last post by:
Problem 1 ======= I need to create a page for a friend who operates a school website. She needs to set up a page so that only the Governors can access it. I thought I'd try to use JavaScript to...
8
by: gngui | last post by:
Hi, Please Please Please anyone out there, if you have a solution, i will highly appreciate as i have searched the internet for 5 days now with no hope. 1st, the versions i am using are Ms Access...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.