is there a way to track program flow in an accde file.
When I run my software in debug mode it behaves as I want it.
When I run it in accde mode it goes through the startup procedure twice.
I have recompiled many times, without error but still get this same behaviour.
I cannot post the full code as there is module based code involved.
The software is started with a basic "autoexec" macro which calls an empty form that opens a setup form, acdialog, that processes data paths and relinks tables if necessary. Once complete this form closes and calls a backup form, acdialog, that maintains the backup folder. It copies the current data tables and then removes any redundant files, files more than 6 weeks old
Below is the code involved, minus any module based code.
The standard run is;
Autoexec calls "Startup"
Startup calls "SetAll", acdialog
SetAll calls "backup", acdialog
Backup calls "Main menu"
I'll post the rest of the code in a follow up....
f necessary I can pull out of the module based code but that will take some time.
Generally it consists of commonly used subs and functions.
The "Starter" form
	
	
	
		
The "Setup" form
	
	
	
		
 When I run my software in debug mode it behaves as I want it.
When I run it in accde mode it goes through the startup procedure twice.
I have recompiled many times, without error but still get this same behaviour.
I cannot post the full code as there is module based code involved.
The software is started with a basic "autoexec" macro which calls an empty form that opens a setup form, acdialog, that processes data paths and relinks tables if necessary. Once complete this form closes and calls a backup form, acdialog, that maintains the backup folder. It copies the current data tables and then removes any redundant files, files more than 6 weeks old
Below is the code involved, minus any module based code.
The standard run is;
Autoexec calls "Startup"
Startup calls "SetAll", acdialog
SetAll calls "backup", acdialog
Backup calls "Main menu"
I'll post the rest of the code in a follow up....
f necessary I can pull out of the module based code but that will take some time.
Generally it consists of commonly used subs and functions.
The "Starter" form
		Code:
	
	
	Option Compare Database
Option Explicit
Private Sub Form_Load()
    DoCmd.Close acForm, Me.Name
    DoCmd.OpenForm "setall", , , , , acDialog
End SubThe "Setup" form
		Code:
	
	
	Option Compare Database
Option Explicit
Private bLink As Boolean
Public Sub setPathways()
    getDrive
    If Nz(TempVars!patha, "") = "" Then TempVars!patha = TempVars!Drive.Value
    If TempVars!patha <> TempVars!Drive Then
        strMessage = "Drives """ & TempVars!Drive & """ and """ & TempVars!patha & """ have been detected." & vbCrLf & _
                    "Do you want to continue with """ & TempVars!patha & """?"
        strImage = "I"
        bOK = False
        If Not Messenger Then TempVars!patha = TempVars!Drive.Value
    End If
    isH
    TempVars!src = TempVars!patha & "Herbarium Database Storage\Herbarium Database\CURRENT HERB COLLECTION DB\split\Don McNair Herbarium"
    TempVars!BUP = TempVars!patha & "Backup\"
    TempVars!Jpg = TempVars!patha & "Images\All JPG Images\"
    TempVars!LYN = TempVars!patha & "Herbarium Database Storage\LYNDA\"
    TempVars!OTH = TempVars!Jpg & "Others\"
    TempVars!TRK = TempVars!Jpg & "PlantTrack\"
    TempVars!SBC = TempVars!Jpg & "SBCollection\"
    TempVars!COL = TempVars!Jpg & "Collier_Collection\"
    TempVars!OUR = TempVars!Jpg & "Ourimbah Collection\"
    TempVars!HRB = TempVars!Jpg & "Herbarium Collection\"
    TempVars!NPC = TempVars!Jpg & "National Parks Collection\"
End Sub
Private Function getDrive() As String
    Dim sDrive As String
    Dim nChar  As Long
    nChar = 68
    Do
        sDrive = Chr(nChar)
        If oFSO.FolderExists(sDrive & ":\Images") Then
            If Not GetMappedDrive(sDrive) Then
                TempVars!Drive = sDrive & ":\"
            End If
        End If
        nChar = nChar + 1
    Loop While nChar <= 88
    getDrive = " "
End Function
Private Function GetMappedDrive(ByVal sDrive As String) As Boolean
    Dim sPath As String
    sPath = sDrive & ":\Images"
    If oFSO.getDrive(sDrive).DriveType = 3 Then '3 => Network
        If oFSO.FolderExists(sPath) Then
            TempVars!patha = sDrive & ":\"
            GetMappedDrive = True
        End If
    Else
        GetMappedDrive = False
    End If
End Function
Public Sub doCR()
    Dim sDest As String
    Dim sTemp As String
    Dim bRes  As Boolean
    Dim nNum  As Integer
    nNum = IIf(isNetwork, 29, 26)
    Me.btnNothing.Caption = "Compacting the data tables"
    sTemp = Left(TempVars!src, Len(TempVars!src) - nNum)
    sDest = sTemp & "backup.accdb"
    FileCopy TempVars!src, sTemp & "temp.accdb"
    If oFSO.FileExists(sDest) Then Kill sDest
    bRes = Application.CompactRepair(TempVars!src, sDest)
    If bRes Then
        Kill TempVars!src
        Kill sTemp & "temp.accdb"
        Name sDest As TempVars!src
    Else
        Me.btnNothing.Caption = "Unsuccessful. Restoring the tables."
        Name sTemp & "temp.accdb" As TempVars!src
        Pause 2
    End If
End Sub
Public Sub GetBeSize()
    Dim File     As File
    Dim FileSize As Long
    Dim sTemp    As String
    sTemp = Left(TempVars!src, Len(TempVars!src) - 5) & "laccdb"
    If Not oFSO.FileExists(sTemp) Then
        Set File = oFSO.GetFile(TempVars!src)
        FileSize = File.Size / 1024
        If FileSize > 80000 Then doCR
    End If
End Sub
Public Sub re_Link()
    Dim T       As TableDef
    Dim td      As TableDefs
    Dim sSource As String
    On Error Resume Next
    Set td = oDB.TableDefs
    sSource = TempVars!src & "_be.accdb"
    For Each T In td
        If T.Connect <> ";DATABASE=" & sSource Then
            T.Connect = ";DATABASE=" & sSource
            T.RefreshLink
        End If
    Next
    Set T = Nothing
    Set td = Nothing
End Sub
Private Sub UpdateFrontEnd()
    Dim FDT1    As Date
    Dim FDT2    As Date
    Dim oFile   As Object
    Dim pathBat As String
    If oFSO.FileExists(TempVars!patha & "FE_Update\Don McNair Herbarium.accde") Then
        Set oFile = oFSO.GetFile(TempVars!patha & "FE_Update\Don McNair Herbarium.accde")
        FDT1 = DateValue(oFile.DateCreated)
        Set oFile = oFSO.GetFile("C:\Access Front End\Don McNair Herbarium.accde")
        FDT2 = DateValue(oFile.DateCreated)
        If FDT1 = FDT2 Or FDT1 < FDT2 Then Exit Sub
        strMessage = "A new copy of the software has been found." & vbCrLf & _
                    "This program will close, update and restart." & vbCrLf & _
                    "This will only take a minute, or so...."
        strImage = "I"
        bOK = True
        Messenger
        pathBat = TempVars!patha & "FE_Update\update.bat"
        Shell pathBat, vbHide
    End If
    Set oFile = Nothing
End Sub
Private Sub Form_Load()
    isCoffee = False
    Me.txtslow.Visible = False
'    If oFSO.FileExists(TempVars!patha & "FE_Update\update.bat") Then
        Me.txtslow = "~ ~ This could take a while ~ ~"
        Me.txtslow.Visible = True
'    End If
    Me.Visible = True
    Me.btnNothing.Caption = "Setting the data paths"
    Me.Repaint
    setPathways
    Me.btnNothing.Caption = "Checking for program updates"
    Me.Repaint
    UpdateFrontEnd
'    GetBeSize
    Me.btnNothing.Caption = "Re-linking the data files"
    Me.Repaint
    re_Link
    oDB_Clear
    oFSO_Clear
    closer
    DoCmd.OpenForm "backup", , , , , acDialog, "go"
End Sub 
	 
 
		