Расширение Syscmd для компиляции и сохранения модулей
Extended solution for "USING SYSCMD TO SAVE AND COMPILE MODULES"
Applies to: Access 97
'***** CODE START
Function SaveAndCompile() As Boolean
'An easy way to save and compile an application's modules is to include
'the SysCmd() function in an existing procedure (or create a new one).
SysCmd 504, 16483
'Added by Dejan Mladenovic 24 Nov 1999:
'SysCmd 504, 16483 fails if compile error(s) are encountered during
'For example, function TestCompile has no syntax errors - Access lets you
'without any warnings. If you try menu command Debug/CompileAllModules you
'message Compile error: method or data member not found.
'Unfortunately, SysCmd simply fails to compile/save without any messages
'To deal with situations like this, I have added few things to the original
'1. Declared function As Boolean
' The function Returns FALSE any errors encountered in compilation
' The function returns TRUE if compilation was successful
' Msgbox is added to warn user of any problems.
' Since SysCmd does not point to the error directly, user is advised to
do manual compilation
' in order to locate the error
' If preferred, Else part of MsgBox may be skipped
' ****** This addition by no means makes original function less valuable.
All credit for brilliant idea
' ****** goes to the author of the original function.
'This will check if SysCmd 504, 16483 was successful:
SaveAndCompile = Application.IsCompiled
'Notify user about results of the attempt to compile/save
If Not IsCompiled Then
MsgBox "Compilation process failed due to non-syntax errors in source
code!" & vbCr _
& "Please use menu command Debug /Compile And Save All Modules to find
MsgBox "Successfully compiled and saved all modules!"
'Function with error:
Dim rs As Recordset
rs.Description = 3 'This is an error, although syntax is OK
'***** CODE END
From Dejan Mladenovic , Entry Date 25.11.1999