Not a valid password error

  • Thread starter Thread starter ridders
  • Start date Start date
R

ridders

Hi

I am trying to create a table in a linked datbase which has a password.
I get a 'Not a valid password' error even though I know the password is
correct.
For example, the SQL used would be:

SELECT * INTO Table1 IN 'G:\My Laptop Files\TEST.mdb'[;PWD=1234]
FROM qry1;

where Table1 is the new table in database Test.mdb with password 1234 based
on query qry1

I am using Access 2003 SP3 with Access hotfix
Please can someone help me solve this irritating error

This approach of course works fine if th external database has no password.
 
On Sat, 25 Jul 2009 05:08:01 -0700, ridders

I never use this syntax myself, but I would guess you need to write:
IN 'G:\My Laptop Files\TEST.mdb[;PWD=1234]'
Also not sure about the square brackets. Omit them if the first one
does not work.

-Tom.
Microsoft Access MVP
 
Hi Tom

The code I gave is direct from the query build editor
The square brackets are needed due to ; before PWD=

In fact as I use a string for a password its:
SELECT * INTO Table1 IN 'G:\My Laptop Files\TEST.mdb'[;PWD='mypassword']
FROM qry1;

I've since tried creating the table in VBA:

Dim db As DAO.Database

If strPw <> "" Then 'password protected database
Set db = DAO.OpenDatabase(strPath, False, False, _
";PWD='mypassword')
Else 'no password needed
Set db = DAO.OpenDatabase(strPath, False, False)
End If

'Now the external db is open, the password isn't needed again:
DoCmd.RunSQL "SELECT * INTO Table1" & _
" IN 'G:\My Laptop Files\TEST.mdb'" & _
" FROM qry1;"

This works fine...


Tom van Stiphout said:
On Sat, 25 Jul 2009 05:08:01 -0700, ridders

I never use this syntax myself, but I would guess you need to write:
IN 'G:\My Laptop Files\TEST.mdb[;PWD=1234]'
Also not sure about the square brackets. Omit them if the first one
does not work.

-Tom.
Microsoft Access MVP

Hi

I am trying to create a table in a linked datbase which has a password.
I get a 'Not a valid password' error even though I know the password is
correct.
For example, the SQL used would be:

SELECT * INTO Table1 IN 'G:\My Laptop Files\TEST.mdb'[;PWD=1234]
FROM qry1;

where Table1 is the new table in database Test.mdb with password 1234 based
on query qry1

I am using Access 2003 SP3 with Access hotfix
Please can someone help me solve this irritating error

This approach of course works fine if th external database has no password.
 
Back
Top