Make mde file from MS Access 97


Question

How to make mde file form within MS Access 97 ?

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
To: ACCESS-L <ACCESS-L@PEACH.EASE.LSOFT.COM>
Subject: Make mde file from MS Access 97
Date: 24 September 1998 2:07

Hi All,

Enclosed you'll find a function I use to compile MDBs into MDEs. Probably I've missed something but I cannot find a way how to make MDE files without SendKeys - using command line options, syscmd or ... ? I would be very grateful if you give me a hint.

TIA,
Shamil

P.S. The code:

'*+
' Purpose: Compile MS Access 97 .mdb file running another instance of MS Access 97
'
' Written by Shamil Salakhetdinov
' e-mail: shamil@marta.darts.spb.ru
'*-

Public Function smsMakeMde(ByVal vstrDstMdbPath As String, _
                            ByVal vstrDstFileName As String, _
                            Optional ByRef robjAcc As Access.Application = Nothing) As Boolean
    On Error GoTo smsMakeMde_Err
    
    smsMakeMde = False
    
    Dim objAcc As Access.Application
    
    If Not robjAcc Is Nothing Then
        Set objAcc = robjAcc
    Else
        Set objAcc = New Access.Application
    End If
    
    objAcc.RefreshTitleBar
    
    DoEvents
    
    objAcc.Visible = True
    DoEvents
    
    SendKeys vstrDstMdbPath & vstrDstFileName & ".mdb"
    SendKeys "{Enter}"
    SendKeys vstrDstMdbPath & vstrDstFileName
    SendKeys "{Enter}"
    
    objAcc.DoCmd.RunCommand acCmdMakeMDEFile
    DoEvents
    objAcc.Visible = False
    
    smsMakeMde = True
    
smsMakeMde_exit:
    If robjAcc Is Nothing Then
       objAcc.Quit
    End If
    Set objAcc = Nothing
    Exit Function
smsMakeMde_Err:
    MsgBox "smsMakeMde: " & Err.Number & " - " & Err.Description
    Resume smsMakeMde_exit
End Function

Copyright 1999-2008 by Shamil Salakhetdinov. All rights reserved.