Unexpected Pause in VBA Execution, no errors or anything to suggest code error

AUGuy

Newly Registered Idiot
Local time
Today, 03:17
Joined
Jul 20, 2010
Messages
135
I've got a function (shown below) that is called on startup through an Autoexec macro. Occasionally it opens the code window, highlights the "set rs =..." line and pauses. It doesn't show an error or indicate a problem, it just pauses. I can hit the resume button (the play button) and it'll continue right along and finish out the module.

I've never had this problem before and I don't see many people with similar ones with a google search.

Any thoughts?

Code:
Public Function Startup()
'On execute, checks filepath for the data file (exported from the AAG database
'If it exists, it renames the file, imports it, and kills the orignial.
Dim dtLastRun As Date
Dim rs As Recordset
Dim db As Database
Dim strFilePath As String
Dim strFileName As String
Dim strNewFileName As String
Dim fso As Object
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_DbStats").Clone
Set fso = CreateObject("Scripting.FileSystemObject")
strFilePath = "[URL="file://\\wil-netapp02\sp-asset\SO-ORE-XLS\ORE_Database_Security\"]\\wil-netapp02\sp-asset\SO-ORE-XLS\ORE_Database_Security\[/URL]"
strFileName = "Qry_ALL_CL_TAMS_Extract.txt"
strNewFileName = "TAMs_Extract.txt"
dtLastRun = rs("LastUpdate").Value
 
If dtLastRun = Date Then GoTo EndFunct
If fso.FileExists("[URL="file://\\wil-netapp02\sp-asset\SO-ORE-XLS\ORE_Database_Security\Qry_ALL_CL_TAMS_Extract.txt"]\\wil-netapp02\sp-asset\SO-ORE-XLS\ORE_Database_Security\Qry_ALL_CL_TAMS_Extract.txt[/URL]") = True Then
    FileCopy strFilePath & strFileName, strFilePath & strNewFileName
    Kill strFilePath & strFileName
    DoCmd.TransferText acImport, "TAMs_Extract Import Specification", "tbl_CL_Extract", strFilePath & strNewFileName, False
    rs.Edit
    rs("LastUpdate") = Date
    rs.Update
    rs.Close
Else
    MsgBox "The CL extract has not yet been loaded into the system." & Chr(10) & "The database will function normally, but loan data may not be up-to-date." & Chr(10) & "The data will be loaded as soon as it's available.", vbOKOnly, "Update Error - New File Not Available"
    rs.Close
    End
End If
EndFunct:
End Function
 
I would suspect corruption - a "phantom" debug break point. Try importing all objects into a new db. And/or decompile.
 

Users who are viewing this thread

Back
Top Bottom