-
July 18th, 2002, 05:27 AM
#1
cant open database
Im trying to open a database using code
Set db = OpenDatabase("C:\....\database.mdb", True, ReadOnly, "password") and I get an error message 'insertable ISAM not found'.
Database opens ok with password removed
ISAM in help refers to excel but not access which Im using for the db
Any ideas?
Regards
Brian
-
July 18th, 2002, 06:58 AM
#2
Yes, infact I too had this error once and observed that it occurs while using providers (dsn less connection) with password protected access databases. If you remove the password the code will work fine with the same mdb.
To retain the password I had to use a dsn, instead of provider. But the real solution is somewhere with the correct driver, I suppose.
See this thread also. Might help
Regards
Debashish Chakrabarty
SCJP
******************************
Cool Site for SCJP aspirants at:
http://www.geocities.com/wahjava
******************************
-
July 18th, 2002, 06:59 AM
#3
From the Office 97 help
here's the prototype of the function
set database = workspace.Opendatabase(Name as String,[options],[ReadOnly],[Connect]) as database
This looks like your connect argument and your options argument are not good.
The connect argument is expressed in two parts: the database type, followed by a semicolon (;) and the optional arguments. You must first provide the database type, such as "ODBC;" or "FoxPro 2.5;". The optional arguments follow in no particular order, separated by semicolons. One of the parameters may be the password (if one is assigned). For example:
"FoxPro 2.5; pwd=mypassword"
Using the NewPassword method on a Database object other than an ODBCDirect database changes the password parameter that appears in the ";pwd=..." part of this argument. You must supply the options and read-only arguments to supply a source string. See the Connect property for syntax.
To close a database, and thus remove the Database object from the Databases collection, use the Close method on the object.
Note When you access a Microsoft Jet-connected ODBC data source, you can improve your application's performance by opening a Database object connected to the ODBC data source, rather than by linking individual TableDef objects to specific tables in the ODBC data source.
Nicolas Bohemier
-
July 18th, 2002, 08:56 AM
#4
Try something like this:
Code:
Set db = OpenDatabase("C:\....\database.mdb", False, True, "MS Access;pwd=password")
-
July 19th, 2002, 01:39 PM
#5
I`m getting the drift of the solution but using
Set db = OpenDatabase("C:\....\database.mdb", False, True, "MS Access;pwd=password")
still gives me the error 3170. I`ve picked up on another thread posted by SoniaE which hints that the DLL file might be in the wrong place. Any comments?
Regards B
-
July 19th, 2002, 02:14 PM
#6
Check your private messages.
-
July 19th, 2002, 02:35 PM
#7
Top open a password protected Access database, you can use the following code: (works for 97 and 2000).
Code:
#If Win32 Then
DBEngine.IniPath = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Issues"
#Else
DBEngine.IniPath = AppIni
#End If
DBEngine.SystemDB = SysDb
DBEngine.DefaultPassword = AppPwd 'Set the password for the user about to logon
DBEngine.DefaultUser = AppUsr 'Set the user id of the user about to logon.
10 Set WS = DBEngine.CreateWorkspace(AppUsr, AppUsr, AppPwd, dbUseJet) 'Create a workspace for this user
DBEngine.Workspaces.Append WS
20 Set IssuesDB = WS.OpenDatabase(DBName, False, False)
Hope this helps,
JP
JP
Please remember to rate all postings.
-
July 20th, 2002, 01:44 PM
#8
MKSA`s code works a treat and it has the merit of brevity.
Thanks for all support
Regards
Brian F
-
July 22nd, 2002, 04:35 AM
#9
My code will work if you use a different SYSTEM.MDW than the one in the windows directory. You get the system database by changing the last entry in the
DBEngine.IniPath = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Issues
line i.e. ISSUES (this is the name of my application).
JP
Please remember to rate all postings.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|