PDA

View Full Version : zms_Startup()



sepoto
06-13-2011, 12:41 PM
I'm dealing with an external library called zMagic. I'm finding that just because I replaced one of the tables in the database with a linked table zms_Startup() is failing. I'm pasting the code in the hopes someone might have some insight into why it is failing. The code for this function sits inside an "add-in" database which is referenced by my main database and called from the main database which is preventing me from debugging. I can not step into the function in other words because it is coming from an add-in.



'**********************************************************************
' Function: zms_Startup()
'
' Scope: Global
'
' Overview: This is the application starting point. The attached tables
' are updated and run-time verses development options are set.
'
' Returns: True/False.
'
'**********************************************************************
Function zms_Startup() As Boolean
On Error GoTo ErrorHandler
Dim msg As String, ctr As Integer, fOK As Boolean

Const cstrProc = mModule & " --> zms_Startup"
Call zms_ValidateFoundation
'=============================================================
Dim fReturn As Boolean
Dim datProgStart As Date
Dim vntRetVal As Variant
Dim X As Variant
Dim strFormName As String
Dim fNewDataPath As Boolean

Const ZMS_CONTACT_ONERROR = 11069

zms_DebugLog "zms_Startup: " & CurrentDb.Name, True

datProgStart = Now()

'DoCmd.Hourglass True

' A97 has a bug that causes built in functions like:
' Left, Mid, and Format to not be recognized if the
' running machine has newer versions of Referenced Files (Tool | References)
' The following procedure checks for and solves any version differences
'Call CheckRefs
'Call Syn_References.Test

'This call determines if the command-line arguments
'will override the DATADB settings in the AppOptions.
Call zms_CheckArguments

'Set Code DB
'''''''''''''''''''''''''''''''''''''''
If Not zms_SetGlobalDBRefs() Then 'True if successful.
GoTo Done
End If

'Verify attached tables
'''''''''''''''''''''''''''''''''''''''
'' If Not zms_TableAttachments() Then 'Attachment Failed
'' msg = "We were unable to attach the data tables. " _
'' & "You were given the opportunity to select " _
'' & "the database file, yet that was also unsuccessful. " _
'' & "It is possible that the names of the tables have changed " _
'' & "or have become corrupt. " & zms_LoadString(ZMS_CONTACT_ONERROR)
''
'' MsgBox msg, vbCritical, "Table Attachment Error"
''
'' If zms_RuntimeMode <> grtModeClient Then
'' Stop
'' End If
''
'' Call zms_ApplicationQuit
'' Exit Function
'' End If
''
'' Call zms_CheckVersion

'Run the rest of this code?
'''''''''''''''''''''''''''''''''''''''
If Not zms_GetAppOption("APP_RUN_AUTOEXEC") Then
MsgBox "Not running Startup."
GoTo Done
End If

'Clear Error Log
'''''''''''''''''''''''''''''''''''''''
If False Then ' Not zms_ErrorHandler_ClearERHlogs() Then 'True if successful.
msg = "Unable to clear Error Logs. While it may be possible to continue, " _
& "this indicates a serious problem. " & zms_LoadString(ZMS_CONTACT_ONERROR) & vbCrLf _
& vbCrLf _
& "Would you like to continue?"
If vbYes <> MsgBox("msg", vbQuestion + vbYesNo, "Error Log") Then
GoTo Done
End If
End If

' Open Switchboard if Switchboard Tables exist.
zms_OpenSwitchboard

fReturn = True

'--------------------
Done:
zms_Startup = fReturn
If Not fReturn Then
zms_ApplicationQuit
End If
Exit Function

ErrorHandler:
Select Case Err.Number
Case Else
Select Case zms_InternalErrorHandler(cstrProc, Err.Number, Err.Description)
Case zms_ErrRetry ' Error was auto handled, resume offending line
Resume
Case zms_ErrContinue ' User selected "Continue"
fReturn = False
Resume Done
Case zms_ErrDebug ' User selected "View Code"
Stop
Resume
End Select
End Select
End Function

HiTechCoach
06-13-2011, 08:03 PM
The code you posted makes lots of calls to other code. It will be very difficult to debug this code without seeing all the VBA code used.

sepoto
06-13-2011, 10:54 PM
Thank you for your reply. I certainly would not expect you to debug the code yourself but the code is in an external .mda (Microsoft Add-in) file and I can not debug it! Do you know how to debug one these $%%^&ing .mda's?

Thank you!

sepoto
06-14-2011, 12:15 AM
Essentially what happens is when I step into zms_Startup I go here automatically somehow. That is not what I normally see which would be inside the function zms_Startup().

Function zMagic_GetAppStatus() As Boolean
zMagic_GetAppStatus = mfAppStatus
mfAppStatus = True
End Function

hansup
06-14-2011, 07:24 AM
the code is in an external .mda (Microsoft Add-in) file and I can not debug it! Do you know how to debug one these $%%^&ing .mda's?
You could try making a copy of the MDA and changing the file extension of the copy to MDB. Then open the MDB in Access to see whether you can view the code modules.

I found limited success with that method. Some add-in authors leave the source available so you can read it. Others lock it down so you can't.

sepoto
06-14-2011, 10:43 AM
What I was actually dealing with was an .mde. I replaced the reference of the .mde with the corresponding .mda and now I can debug!