asked on
Function AddFile() As LongPtr
On Error GoTo ErrHandler
Dim strFilePath As String
Dim strFileText As String
Dim strFileName As String
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "PDFs", "*.PDF"
.Show
strFilePath = .SelectedItems(1)
End With
If strFilePath = "" Then Exit Function
If GetRecordCount("SELECT * FROM FILE_LIST WHERE FILE_PATH =" & Chr(34) & strFilePath & Chr(34)) > 0 Then
err.Raise -666, , "This File is Already Loaded!"
End If
strFileName = Right(strFilePath, Len(strFilePath) - InStrRev(strFilePath, "\"))
strFileText = GetFileText(strFilePath)
AddFile = AddToFileList(strFilePath, strFileName, strFileText)
If AddFile <> 0 Then Exit Function
Me.lstFiles.Requery
Me.lblFileList.Caption = GetRecordCount("FILE_LIST") & " Files"
Me.lstFiles = Me.lstFiles.ItemData(Me.lstFiles.ListCount - 1) 'should always be at least one
Call lstFiles_AfterUpdate
Me.cmdParseBMPs.Enabled = True
ErrHandler:
DoCmd.SetWarnings True
AddFile = ErrorHandler(err, "AddFile")
End Function
ASKER
ASKER
ASKER
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
Open in new window