Solved

VB4 can't find Systemdatabase

Posted on 1997-07-25
8
193 Views
Last Modified: 2012-08-14
We want to use the security of MSAccess from a
VB application.
We are  doing the following

1.We enabled the security of MSAccess
2. Set path to Systemdatabase in INI-Files
Set SystemDB=C:\Access\system.mda
(under [OPTION])
in vb.ini; .ini; win.ini; msacc20.ini
3. following as code :
dim gws as workspace
Set DBEngine=Nothing
Set DBEngine.IniPath=C:\Windows\.ini
Set DBEngine.UserID="Admin"
Set DBEngine.Password=password     equal as in MSAccess security
Set gws=DBEngine.Workspaces(0)

4. Error Message
we get an error with following message
"Can't start. The system database(typically SYSTEM.MDA) is missing or opened exclusivly by another user."

But we do have SYSTEM.MDA in c:\access

Thanks for any help.
0
Comment
Question by:micha71
8 Comments
 
LVL 3

Expert Comment

by:ESI
Comment Utility
Don't u need to make a CreateWorkSpace & then an Workspaces.Append, instead of using the default workspace #0 ?
If u want use the default workspace #0, use DBEngine.DefaultUser & DBEngine.DefaultPassword then !
but I think the best solution is to create a new workspace & append it to the dbengine workspaces collection.
Look in the help under CreateWorkspace.
Hope it helps !
0
 

Author Comment

by:micha71
Comment Utility
Edited text of question
0
 
LVL 3

Expert Comment

by:ChrisLewis
Comment Utility
Try creating an INI called with the same name as your executable and putting the [Options] & SystemDB=C:\Access\system.mda  lines in there.

If your EXE name is TEST.EXE, use the INI TEST.INI

I think IniPath Is used for Jet 3.0 & greater where the Options  are stored in the Registry.

Default for Access 2.0 /Jet 2.0 & 2.5 is to look in the exe for the [Options] block with SystemDB=C:\Access\system.mda

Hope this helps,

Chris

0
 

Author Comment

by:micha71
Comment Utility
Adjusted points to 150
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:staylor081797
Comment Utility
I believe you may be using VB 4 Pro 32 bit, maybe VB 5.   If that is the case the IniPath of the DBEngine is not used as it is in the 16 bit version.    In the 32 bit version the property is SystemDB.  In place of DBEngine.Inipath = "Path to ini file" use the following.

DBEngine.SystemDB = "Path to System.mda" or System.mdw.  

Search Help on SystemDB and that should clarify it further.
0
 

Author Comment

by:micha71
Comment Utility
I use VB 4 16 bit.

Thanks.
0
 
LVL 1

Accepted Solution

by:
haas090897 earned 150 total points
Comment Utility
I just read that SystemDB only applies to vb 4 32 bit.
In 16 bit you need to use the Dbengine.inipath property or put the system.mdw file in current directory and use SetDefaultWorkspace or create a new Workspace.

Try to use GetSetting to retrieve the path to System.mdw
Syntax
GetSetting(appname, section, key,[default])

0
 

Author Comment

by:micha71
Comment Utility
Dear ChrisLewis

I do have a application INI with this line.
I had wrote this in my question(after vb.ini) but it wasn't
shown.

Thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now