SetDefaultWorkgroupFile Critical Error

D

dalbin

I have some code in an Access 2003 Database that creates and MDE File. The
code has functioned for over a year, but now, all of a sudden, I receive a
critical error when I run the code. The error states that Microsoft Access
has encountered a problem and must close.

Can anyone tell me why I am receiving this error and how to avoid it? Or,
is there a better way to generate an MDE file programatically? Thank you, in
advance, for your help.

I have isolated the problem to the SetDefaultWorkgroupFile command. My code
looks like this (and is located in a function):

Dim AccApp As Access.Application
Dim strReqWorkgroup as String
Dim strPassword as String
Dim strReqMDE as String
Dim strReqMDB as String
strReqWorkgroup = "\\MyDrive\MyDatabase\System.mdw" 'This is a valid file
strReqMDE = "\\MyDrive\MyDatabase\DatabaseName.mde" 'This is a valid
file
strReqMDB = "\\MyDrive\MyDatabase\DatabaseName.mdb" 'This is a valid
file
strPassword = "thisismypassword" 'This is a valid password

Set AccApp = New Access.Application
AccApp.SetDefaultWorkgroupFile strReqWorkgroup
SendKeys strPassword & "{ENTER}", False
On Error Resume Next
objFS.DeleteFile strReqMDE
On Error GoTo 0
AccApp.SysCmd 603, strReqMDB, strReqMDE
Set AccApp = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top