I tried the SendKeys method early on, when trying to automate my
build process. The build process first compiles the library
databases, then converts the front-end database references from
the uncompiled libraries to the newly-compiled libraries using
automation, then compiles the front-end databases, and finally
resets the front-end references back to uncompiled development
status.
For this build process, the SendKeys method outlined in the
Knowledge Base article did not work consistently for me. Under
automation, the dialog did not always get the right keys and the
compile would fail. On the other hand, the SysCmd 603 approach
has been very stable and has never caused problems. (Naturally, I
do back up all files first as part of the build.)
I do not recall who first mentioned this command (MichKa?), but I
seem to recall it was used by Microsoft in the Access wizards. It
has been cited a number of times in comp.databases.ms-access, and
it has always worked much better than SendKeys for me.
- Steve
Quote:
> While I agree that SendKeys is not the best approach for
coding, I'm puzzled
> as to why you'd think an undocumented method is any more
reliable or safer.
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
message
> > As you know, SendKeys can be unreliable and dangerous if
multiple
> > applications are running, since it may end up going to the
wrong
> > application or dialog.
> > Access 97 and 2000 both have an undocumented SysCmd 603 for
this,
> > with sample code below. As of Access 2000, it appears that
you
> > must used automation.
> > - Steve
> > ' SysCmd 603 is an undocumented method to make Mde,
> > overwriting any existing File, may not work if database is
locked
> > ' For Access 2000, must call SysCmd 603 using automation,
> > otherwise it does nothing
> > Dim appAccess As Access.Application
> > Set appAccess = CreateObject("Access.Application." &
> > Left$(SysCmd(acSysCmdAccessVer), 1))
> > appAccess.Visible = True
> > appAccess.SysCmd 603, strDbFile, strMdeFile
> > appAccess.Quit
> > Set appAccess = Nothing
message
> > > Hello Mick! My name is Rachel Ceraul. Thank you for
> > using the
> > > Microsoft Access Newsgroups. If I understand your issue
> > correctly, you are
> > > looking for a way to create an .mde file through code. I
have
> > included an
> > > article link below that should walk you through a process
that
> > will assist
> > > you with this. If the steps in the article do not work,
please
> > respond to
> > > this posting including the steps you are taking and the
error
> > message that
> > > you are receiving.
> > > I hope this helps! If you have additional questions
on
> > this topic,
> > > please reply to this posting.
> > > ACC2000: How to Programmatically Save a Database as an MDE
File
http://support.microsoft.com/support/kb/articles/q202/0/39.asp
Quote:
> > > Regards,
> > > Rachel Ceraul
> > > Microsoft Support
> > > This posting is provided "AS IS" with no warranties, and
> > confers no rights.