473,480 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OpenDatabase - Error 3031 - Not a valid password

NeoPa
32,556 Recognized Expert Moderator MVP
In my code :
Expand|Select|Wrap|Line Numbers
  1.     strConnect = Replace("MS Access;PWD=%P", "%P", Scramble(conLinkPW))
  2.     Set dbThat = wsVar.OpenDatabase(Name:=strDBPath, _
  3.                                     Options:=True, _
  4.                                     Connect:=strConnect)
the variable strConnect is set up with a perfectly valid string - correctly formatted. My code doesn't use visible password strings but I was able to test the value and it matched the database password exactly :
Expand|Select|Wrap|Line Numbers
  1. MS Access;PWD=XXXXX
The code above kept failing with the error :
Expand|Select|Wrap|Line Numbers
  1. Run-time error 3031:
  2. Not a valid password.
I've tried all sorts of variations of the string, but all with the same results.
How to use the OpenDatabase method to open password-protected databases in Access 2000 indicates how this string should be formatted, and mine matches that perfectly.
Feb 10 '13 #1
3 9058
NeoPa
32,556 Recognized Expert Moderator MVP
I did some more Googling (I'd already done a fair bit before posting of course.) and found myself back at the same link (How to use the OpenDatabase method to open password-protected databases in Access 2000). This time though, I noticed something very important that wasn't well highlighted (No surprise - It was pointing out an error in the Help file) :
Link:
NOTE: Even though the Options and Read-Only arguments of the OpenDatabase method are documented in Help as being optional arguments, you must provide them when you use the Connect argument.
The following code therefore works perfectly :
Expand|Select|Wrap|Line Numbers
  1.     strConnect = Replace("MS Access;PWD=%P", "%P", Scramble(conLinkPW))
  2.     Set dbThat = wsVar.OpenDatabase(Name:=strDBPath, _
  3.                                     Options:=True, _
  4.                                     ReadOnly:=False, _
  5.                                     Connect:=strConnect)
Feb 10 '13 #2
jimatqsi
1,271 Recognized Expert Top Contributor
Just want to let you know this has been helpful to me today :)
Apr 28 '14 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Very pleased to hear it Jim. This has caught me a couple of times that I'm aware of. I hope now it's here I'll never need to work it all out again.
May 1 '14 #4

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

Similar topics

0
3759
by: Nick Bolink | last post by:
I'm using a ACCESS database that has a databasepassword. In the connection string I'll provide the password as follows: MM_test_STRING = "dsn=test;pwd=test;" This works fine on IIS 5 but on IIS 6...
10
5995
by: Max | last post by:
Hello all, I am trying to protect a page within my site with a JS password scheme. Now I know JS can be quite easily "circumvented", but I came by a code below. My question is: 1. Is there...
6
2369
by: N. Graves | last post by:
Thank you for taking your time to read my question... please offer your knowledge it will be appreciated! I'm writing a ASP Web page to access a Access Database that has a Database Password set....
2
4378
by: Jozef | last post by:
Hello, I have a database that I have passworded. When I try to use OpenDatabase with the Connect parameter filled in, I keep getting "Not a valid password", even if I use the actual connect...
3
1532
by: VB Programmer | last post by:
Right now, if you use the CreateUserWizard for ASP.NET 2.0 a valid password is this: Password length minimum: 7. Non-alphanumeric characters required: 1. How do I change it so that a valid...
0
1190
by: Anatoly Kurilin | last post by:
Hi, I normally use this code for modifying tables in backend files: Set dbsBackEnd = DBEngine.OpenDatabase(strBackEndFileSpecs) Set tdfIncome = dbsBackEnd!tblIncome and so on. This time I need...
5
11047
by: Joe-Paul | last post by:
Hi: I'm using VB 6.0 with an Access 2000 database. I set the password in the Access database to: abcdef1234. Then, using a MDIform, during the load event, I send the program to a procedure to...
2
4390
by: btguser | last post by:
Visual Basic 6 Access 97 Windows 2000 I created a database programmatically with vb. My application is able to create and open the database with the password I set. However, when I manually...
0
1434
by: Nuanda | last post by:
Hi all! I'm working on a simple application java using a ms access database. I created a local db with a password during the coding and it works without problems. Now i'm trying accessing db from...
0
1838
by: calvinkwoo3000 | last post by:
My Window application run property withour link to mdb without password. Once i set security password to mdb file, the error belor come out when i click detail. Not a valid password. and detail...
0
7037
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
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7032
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6730
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
5321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4767
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...
0
4471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.