Can you explain this loop, in the attached video ?
Error in open db
The path for the strFileName is wrong
I run this routine only.
I made it as a SUB to run it directly. Not calling it
Here is the VBA code
This one is to explain thread 320778 more clearly
Error in open db
The path for the strFileName is wrong
I run this routine only.
I made it as a SUB to run it directly. Not calling it
Here is the VBA code
Code:
Public Sub TEST_XXX()
On Error GoTo errHere
Dim strFileName As String
Dim strFilePassword As String
Dim sngLatestVersion As Single
MsgBox "_TEST_XXX - 1"
pbDataPath = GetSetting("Tal Fuchs", pbAppFileName, "DataPath")
strFileName = pbDataPath & "\XXX" & pbDataFileName
strFilePassword = pbDataFilePass
MsgBox "strFileName - " & strFileName
Set DataDB = OpenDatabase(strFileName, False, False, "MS Access; PWD=" & strFilePassword & "")
MsgBox "_TEST_XXX - 2"
strSQL = "SELECT * " & _
"FROM [dbVersions] " & _
"ORDER BY [dbVersion] DESC "
MsgBox "_TEST_XXX - 3"
Set rs = DataDB.OpenRecordset(strSQL)
MsgBox "_TEST_XXX - 4"
With rs
If .RecordCount > 0 Then
.MoveFirst
sngLatestVersion = .Fields("dbVersion")
.Close
Else
sngLatestVersion = 0
End If
End With
MsgBox "_sngLatestVersion = " & sngLatestVersion
MsgBox "_TEST_XXX - 5"
ExitHere:
MsgBox "_TEST_XXX - ExitHere"
Set rs = Nothing
Set DataDB = Nothing
pbErr = Err
pbErrDescription = Err.Description
MsgBox "Error - " & pbErr & "-" & pbErrDescription
Exit Sub
errHere:
pbErr = Err
pbErrDescription = Err.Description
Resume errHandler
errHandler:
Set rs = Nothing
Set DataDB = Nothing
MsgBox "_TEST_XXX - errHere"
MsgBox "Error - " & pbErr & "-" & pbErrDescription
MsgBox "_TEST_XXX - errHere 2"
MsgBox Err
Call pbCleanAfterError
End Sub
This one is to explain thread 320778 more clearly
Last edited: