[AccessD] Call Stack in VBA?

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Sun Jul 27 05:03:40 CDT 2008


Hi Dan and Arthur,

I looked in my archives and I have found the add-in and the support library
for it...

I have published support library here:

http://smsconsulting.spb.ru/download/addins/SMSProfilerLIB.zip 

It's VB6 project, which can be compiled into ActiveX DLL, and the latter can
be used with MS Access...

The source VB6 code of this library can be also put into MS Access library
mdb...

Sorry, this is almost ten years old code - it seems to be clean and
streamlined but not commented well enough...

As for add-in generating calls to profile/trace library - this part of code
have to be additionally worked through as it has some proprietary code with
I signed NDA for - and I have to clean it up...

But you still can use the referred above library/source code to get tracing
obtained and stored in XMl file - see sample in P.S. - the download link
also has this sample.

There are quite some stuff developed here on subject - maybe you Dan and
Arthur and Susan(?) will be interested to team up and write an article/some
articles on this subject of VBA profiling/tracing if that is still
interesting? And I'd act as provider of some advanced code on the subject  -
OK? :)

Thank you.

--
Shamil


P.S.

Here is how tracing can be implemented/tested using the above lib - be
careful with passing/saving object references to trace object as these
references could keep their objects "live" until program quits - that have
to be checked...


Option Compare Database
Option Explicit

#Const TRACE_PROC_CALLS = 1

Public Const APP_NAME As String = "TEST_VBA_TRACING"
Private Const mcstrModuleName As String = "basTestTracingProfiling"

Private Const MAX_INDEX As Integer = 3

Public Function testTracing()
    ' inti tracing/profiling
    smsProfilerLib.Trace.Init
    
    ' --- Test call ---
    Dim index As Integer
    For index = 1 To MAX_INDEX
         TestCallLevel1 "Hello, World!", index
    Next index
    ' --- end of test call --
        
    ' reset tracing/profiling
    smsProfilerLib.Trace.Reset
End Function

Private Property Get xmlFileFullPath() As String
    xmlFileFullPath = CurrentProject.Path + "\profile.xml"
End Property

Public Sub TestCallLevel1(helloWorld As String, index As Integer)
'#region this code block can be generated/removed by add-in
Const cstrProcName As String = "TestCallLevel1"
    #If TRACE_PROC_CALLS Then
        Dim objTrace As Object
        Set objTrace = GetNewTraceObject(APP_NAME, _
                       mcstrModuleName, _
                       cstrProcName, _
                       "helloWorld(String)", helloWorld, _
                       "index(Integer)", index)
    #End If
'#end region
    Dim dbs As DAO.Database
    Set dbs = CurrentDb
    TestCallLevel2 dbs, index
End Sub

Public Sub TestCallLevel2(ByRef rdbs As DAO.Database, ByVal index As
Integer)
'#region this code block can be generated/removed by add-in
Const cstrProcName As String = "TestCallLevel2"
    #If TRACE_PROC_CALLS Then
        Dim objTrace As Object
        Set objTrace = GetNewTraceObject(APP_NAME, _
                       mcstrModuleName, _
                       cstrProcName, _
                       "rdbs(DAO.Database)", rdbs, _
                       "index(Integer)", index _
                       )
    #End If
'#end region

    If index = MAX_INDEX Then
       ' store collected tracing/profiling in XML
       smsProfilerLib.Trace.Store xmlFileFullPath, 1
    End If

End Sub


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Friday, July 25, 2008 11:52 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Call Stack in VBA?

I second that.
Arthur

On Fri, Jul 25, 2008 at 3:38 PM, Dan Waters <dwaters at usinternet.com> wrote:

> As for 100 developers world wide who would want this, I'm sure they exist.
> Two of them are here - me and Arthur!  But for the rest, there would need
> to
> be a way to advertise it's existence.
>
> Does anyone know of a good place to advertise or look for good Access
> utilities and add-in's?
>
> Thanks!
> Dan
>
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list