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
>> >
>>
>>
>>