PC Review


Reply
Thread Tools Rate Thread

CreateWorkspace does not work for me

 
 
nova
Guest
Posts: n/a
 
      19th Dec 2008
I'm going crazy on the below code not working anymore. I have used this in
the past without any problem. Recently I wanted to implement again and for
one reason or another, it seems the systemDB is not assigned correctly.I'm
getting the error 'Not a valid account name or password'. When debugging, the
SystemDB returns the default Access security group instead of the one I'm
trying to assign.
I'm on Win XP, Office 2003, company laptop, so wondering if this could have
to do with local security?

Dim ws As Workspace
Dim db As Database
DBEngine.SystemDB = "C:\mySecureFile.mdw"
Debug.Print DBEngine.SystemDB
Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
Set db = ws.OpenDatabase("C:\myDatabase.mdb")
'... rest of the code
Set db = Nothing
Set ws = Nothing

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      19th Dec 2008
Are you actually providing values for strUser and strPassword before your
call to CreateWorkspace? (Your code doesn't show you doing so...)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"nova" <(E-Mail Removed)> wrote in message
news:FABB4891-BF94-4F53-A46D-(E-Mail Removed)...
> I'm going crazy on the below code not working anymore. I have used this in
> the past without any problem. Recently I wanted to implement again and for
> one reason or another, it seems the systemDB is not assigned correctly.I'm
> getting the error 'Not a valid account name or password'. When debugging,
> the
> SystemDB returns the default Access security group instead of the one I'm
> trying to assign.
> I'm on Win XP, Office 2003, company laptop, so wondering if this could
> have
> to do with local security?
>
> Dim ws As Workspace
> Dim db As Database
> DBEngine.SystemDB = "C:\mySecureFile.mdw"
> Debug.Print DBEngine.SystemDB
> Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> '... rest of the code
> Set db = Nothing
> Set ws = Nothing
>



 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      19th Dec 2008
On Fri, 19 Dec 2008 07:12:59 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_gmail.com> wrote:

(if that was the problem) you need to set:
Option Explicit
at the top of each code module. That will force you to declare your
variables and will hopefully serve as a reminder to give them a value
as well.

-Tom.
Microsoft Access MVP


>Are you actually providing values for strUser and strPassword before your
>call to CreateWorkspace? (Your code doesn't show you doing so...)

 
Reply With Quote
 
nova
Guest
Posts: n/a
 
      19th Dec 2008
Yes, sorry if that wasn't clear. The username and password are declared as
constants. Also, I can use them to log into the secured db using a shortcut
so they're valid.
what's strange to me is that on the debug line, I'm getting the default
workgroup instead of the one that was assigned in the line above.

"Douglas J. Steele" wrote:

> Are you actually providing values for strUser and strPassword before your
> call to CreateWorkspace? (Your code doesn't show you doing so...)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "nova" <(E-Mail Removed)> wrote in message
> news:FABB4891-BF94-4F53-A46D-(E-Mail Removed)...
> > I'm going crazy on the below code not working anymore. I have used this in
> > the past without any problem. Recently I wanted to implement again and for
> > one reason or another, it seems the systemDB is not assigned correctly.I'm
> > getting the error 'Not a valid account name or password'. When debugging,
> > the
> > SystemDB returns the default Access security group instead of the one I'm
> > trying to assign.
> > I'm on Win XP, Office 2003, company laptop, so wondering if this could
> > have
> > to do with local security?
> >
> > Dim ws As Workspace
> > Dim db As Database
> > DBEngine.SystemDB = "C:\mySecureFile.mdw"
> > Debug.Print DBEngine.SystemDB
> > Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> > Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> > '... rest of the code
> > Set db = Nothing
> > Set ws = Nothing
> >

>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      19th Dec 2008
To be honest, I've never had to do something like this. However, the Help
file states "For this option to have any effect, you must set the SystemDB
property before your application initializes the DBEngine object (that is,
before creating an instance of any other DAO object). The scope of this
setting is limited to your application and can't be changed without
restarting your application.", and the examples clearly show setting the
SystemDB property before any other declarations.

Try:

DBEngine.SystemDB = "C:\mySecureFile.mdw"
Debug.Print DBEngine.SystemDB

Dim ws As Workspace
Dim db As Database

Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
Set db = ws.OpenDatabase("C:\myDatabase.mdb")
'... rest of the code
Set db = Nothing
Set ws = Nothing


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"nova" <(E-Mail Removed)> wrote in message
news:F68DC460-5E46-4CCC-AE26-(E-Mail Removed)...
> Yes, sorry if that wasn't clear. The username and password are declared as
> constants. Also, I can use them to log into the secured db using a
> shortcut
> so they're valid.
> what's strange to me is that on the debug line, I'm getting the default
> workgroup instead of the one that was assigned in the line above.
>
> "Douglas J. Steele" wrote:
>
>> Are you actually providing values for strUser and strPassword before your
>> call to CreateWorkspace? (Your code doesn't show you doing so...)
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "nova" <(E-Mail Removed)> wrote in message
>> news:FABB4891-BF94-4F53-A46D-(E-Mail Removed)...
>> > I'm going crazy on the below code not working anymore. I have used this
>> > in
>> > the past without any problem. Recently I wanted to implement again and
>> > for
>> > one reason or another, it seems the systemDB is not assigned
>> > correctly.I'm
>> > getting the error 'Not a valid account name or password'. When
>> > debugging,
>> > the
>> > SystemDB returns the default Access security group instead of the one
>> > I'm
>> > trying to assign.
>> > I'm on Win XP, Office 2003, company laptop, so wondering if this could
>> > have
>> > to do with local security?
>> >
>> > Dim ws As Workspace
>> > Dim db As Database
>> > DBEngine.SystemDB = "C:\mySecureFile.mdw"
>> > Debug.Print DBEngine.SystemDB
>> > Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
>> > Set db = ws.OpenDatabase("C:\myDatabase.mdb")
>> > '... rest of the code
>> > Set db = Nothing
>> > Set ws = Nothing
>> >

>>
>>
>>



 
Reply With Quote
 
nova
Guest
Posts: n/a
 
      19th Dec 2008
thanks for looking into this...
hm, strange as I find this exact same code on the ms support pages
(http://support.microsoft.com/kb/163002)
anyway, I've tried your proposal, but no difference. I also tried executing
this code from Outlook as maybe it had to do with the db I was working in,
but again no difference.

"Douglas J. Steele" wrote:

> To be honest, I've never had to do something like this. However, the Help
> file states "For this option to have any effect, you must set the SystemDB
> property before your application initializes the DBEngine object (that is,
> before creating an instance of any other DAO object). The scope of this
> setting is limited to your application and can't be changed without
> restarting your application.", and the examples clearly show setting the
> SystemDB property before any other declarations.
>
> Try:
>
> DBEngine.SystemDB = "C:\mySecureFile.mdw"
> Debug.Print DBEngine.SystemDB
>
> Dim ws As Workspace
> Dim db As Database
>
> Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> '... rest of the code
> Set db = Nothing
> Set ws = Nothing
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "nova" <(E-Mail Removed)> wrote in message
> news:F68DC460-5E46-4CCC-AE26-(E-Mail Removed)...
> > Yes, sorry if that wasn't clear. The username and password are declared as
> > constants. Also, I can use them to log into the secured db using a
> > shortcut
> > so they're valid.
> > what's strange to me is that on the debug line, I'm getting the default
> > workgroup instead of the one that was assigned in the line above.
> >
> > "Douglas J. Steele" wrote:
> >
> >> Are you actually providing values for strUser and strPassword before your
> >> call to CreateWorkspace? (Your code doesn't show you doing so...)
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no private e-mails, please)
> >>
> >>
> >> "nova" <(E-Mail Removed)> wrote in message
> >> news:FABB4891-BF94-4F53-A46D-(E-Mail Removed)...
> >> > I'm going crazy on the below code not working anymore. I have used this
> >> > in
> >> > the past without any problem. Recently I wanted to implement again and
> >> > for
> >> > one reason or another, it seems the systemDB is not assigned
> >> > correctly.I'm
> >> > getting the error 'Not a valid account name or password'. When
> >> > debugging,
> >> > the
> >> > SystemDB returns the default Access security group instead of the one
> >> > I'm
> >> > trying to assign.
> >> > I'm on Win XP, Office 2003, company laptop, so wondering if this could
> >> > have
> >> > to do with local security?
> >> >
> >> > Dim ws As Workspace
> >> > Dim db As Database
> >> > DBEngine.SystemDB = "C:\mySecureFile.mdw"
> >> > Debug.Print DBEngine.SystemDB
> >> > Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> >> > Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> >> > '... rest of the code
> >> > Set db = Nothing
> >> > Set ws = Nothing
> >> >
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
nova
Guest
Posts: n/a
 
      20th Dec 2008
I may have found a workable solution:
when creating my own instance of DBEngine, it seems to work ok, see code
below. However, I cannot run this code simultaniously from different
applications (ex Outlook and Access). Will need to test if different users
log into the same db.
Thanks again...

dim dbe as DAO.DBEngine
Dim ws As Workspace
Dim db As Database
Set dbe = CreateObject("DAO.DBEngine.36")
dbe.SystemDB = "C:\mySecureFile.mdw"
Debug.Print dbe.SystemDB
Set ws = dbe.CreateWorkspace("New", strUser, strPassword)
Set db = ws.OpenDatabase("C:\myDatabase.mdb")
'... rest of the code
Set db = Nothing
Set ws = Nothing
Set dbe = Nothing


"Douglas J. Steele" wrote:

> To be honest, I've never had to do something like this. However, the Help
> file states "For this option to have any effect, you must set the SystemDB
> property before your application initializes the DBEngine object (that is,
> before creating an instance of any other DAO object). The scope of this
> setting is limited to your application and can't be changed without
> restarting your application.", and the examples clearly show setting the
> SystemDB property before any other declarations.
>
> Try:
>
> DBEngine.SystemDB = "C:\mySecureFile.mdw"
> Debug.Print DBEngine.SystemDB
>
> Dim ws As Workspace
> Dim db As Database
>
> Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> '... rest of the code
> Set db = Nothing
> Set ws = Nothing
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "nova" <(E-Mail Removed)> wrote in message
> news:F68DC460-5E46-4CCC-AE26-(E-Mail Removed)...
> > Yes, sorry if that wasn't clear. The username and password are declared as
> > constants. Also, I can use them to log into the secured db using a
> > shortcut
> > so they're valid.
> > what's strange to me is that on the debug line, I'm getting the default
> > workgroup instead of the one that was assigned in the line above.
> >
> > "Douglas J. Steele" wrote:
> >
> >> Are you actually providing values for strUser and strPassword before your
> >> call to CreateWorkspace? (Your code doesn't show you doing so...)
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no private e-mails, please)
> >>
> >>
> >> "nova" <(E-Mail Removed)> wrote in message
> >> news:FABB4891-BF94-4F53-A46D-(E-Mail Removed)...
> >> > I'm going crazy on the below code not working anymore. I have used this
> >> > in
> >> > the past without any problem. Recently I wanted to implement again and
> >> > for
> >> > one reason or another, it seems the systemDB is not assigned
> >> > correctly.I'm
> >> > getting the error 'Not a valid account name or password'. When
> >> > debugging,
> >> > the
> >> > SystemDB returns the default Access security group instead of the one
> >> > I'm
> >> > trying to assign.
> >> > I'm on Win XP, Office 2003, company laptop, so wondering if this could
> >> > have
> >> > to do with local security?
> >> >
> >> > Dim ws As Workspace
> >> > Dim db As Database
> >> > DBEngine.SystemDB = "C:\mySecureFile.mdw"
> >> > Debug.Print DBEngine.SystemDB
> >> > Set ws = DBEngine.CreateWorkspace("New", strUser, strPassword)
> >> > Set db = ws.OpenDatabase("C:\myDatabase.mdb")
> >> > '... rest of the code
> >> > Set db = Nothing
> >> > Set ws = Nothing
> >> >
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dbEngine.CreateWorkspace =?Utf-8?B?TmFyYXNpbWhhbQ==?= Microsoft Dot NET 1 21st Aug 2007 12:37 PM
run out of memory error 2004 on CreateWorkSpace command with Windo =?Utf-8?B?UC4gU2NhcmFt?= Microsoft Access VBA Modules 5 14th Mar 2006 10:42 PM
VBAJET.dll errors using DAO CreateWorkspace() =?Utf-8?B?SmVmZks=?= Microsoft Access VBA Modules 3 5th Oct 2004 04:20 PM
Dll error resulting from "CreateWorkspace" =?Utf-8?B?bGVubnkza0Bob3RtYWlsLmNvbQ==?= Microsoft Excel Programming 0 9th Jun 2004 09:26 AM
CreateWorkspace Mario Kropik Microsoft Access VBA Modules 2 24th Oct 2003 01:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:46 AM.