Solved

Workspace

Posted on 1998-05-27
3
459 Views
Last Modified: 2006-11-17
Hi

Why the first two lines in the following code cause error in my PC?
Since the third line in the following code can work, why we need to set workspace?
What about workspace(1) and workspace(2)?

set NewWs = DBEngine.WorkSpace(0)
set NewDB = NewWs.OpenDatabase("thefile.mdb", dbLengGeneral)

set NewDB = OpenDatabase("thefile.mdb", dbLengGeneral)
0
Comment
Question by:victorlong
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 40 total points
ID: 1461775
victorlong,
your error probable in WorkSpace(0). It should be workspaces(0).

You don't have to specify workspace.

Regards
Dalin
0
 

Author Comment

by:victorlong
ID: 1461776
Hi Dalin.

You are right.

But what is a workspace in VB?

I also tried
set NewWs = DBEngine.WorkSpaces(1)
and got error :-(

Cheers.
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1461777
victorlong,
You may search for Workspace object (DAO) from the Online help to see what iit is or what it does.

When You first refers to workspace, the jetengine automatically creats workspaces(0).
If you want to use other work spaces, you need to create it by use the CreatWorkspace method then then appending to the collection.

Hope I made myself clear. If you have any additional questions, feel free to ask. You can email me Dalin_N@mailExcite.Com
Regards
Dalin

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

790 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