Solved

Workspace

Posted on 1998-05-27
3
456 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

708 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

10 Experts available now in Live!

Get 1:1 Help Now