|
|
|
| Натолкните на мысль
или ещё как помогите создать поисковик файла (*мойфайл.тхт)на дисках | |
|
| |
|
|
|
| Использовать File System Object (для большого диска будет довольно долго)
http://hiprog.com/index.php?option=com_content&task=view&id=293
только это для VB, для MSA нужно декларирование добавить
Private Declare Function FindClose Lib "kernel32" _
(ByVal hFindFile As Long) As Long
Private Declare Function FindFirstFile Lib "kernel32" _
Alias "FindFirstFileA" _
(ByVal lpFileName As String, _
lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFileA" _
(ByVal hFindFile As Long, _
lpFindFileData As WIN32_FIND_DATA) As Long
Type WIN32_FIND_DATA
dwFileAttributes As Long
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * 260
cAlternate As String * 14
End Type
|
| |
|
| |
|
|
|
| Вот еще функция, выполняющая поиск конкретного файла во всех вложенных папках, начиная
с указанной.
Private Declare Function apiSearchTreeForFile Lib "ImageHlp.dll" Alias _
"SearchTreeForFile" (ByVal lpRoot As String, ByVal lpInPath _
As String, ByVal lpOutPath As String) As Long
Function fSearchFile(ByVal strFilename As String, _
ByVal strSearchPath As String) As String
'Returns the first match found
Dim lpBuffer As String
Dim lngResult As Long
fSearchFile = ""
lpBuffer = String$(1024, 0)
lngResult = apiSearchTreeForFile(strSearchPath, strFilename, lpBuffer)
If lngResult <> 0 Then
If InStr(lpBuffer, vbNullChar) > 0 Then
fSearchFile = Left$(lpBuffer, InStr(lpBuffer, vbNullChar) - 1)
End If
End If
End Function
|
| |
|
| |
|
|
|
| Класс! | |
|
| |
|
|
|
| Огромное спасибо!!!
............ ........... | |
|
| |
|
|
|
| а вот интересное появилося
http://am.rusimport.ru/MsAccess/topic.aspx?id=629 | |
|
| |
|
|
|
| Спасибо вот что вышло..
Call PoiskFayla(Me.direktoriya, "*" & Me.nazvanie_fajla & "*.*")
|
Function PoiskFayla(PAPKA As String, IMA As String)
Dim i As Integer
Dim sResult As String
Application.FileSearch.NewSearch
Application.FileSearch.LookIn = PAPKA
Application.FileSearch.FileName = IMA
Application.FileSearch.SearchSubFolders = True
Application.FileSearch.Execute
Me.progress = "Hайдено файлов =" & Application.FileSearch.FoundFiles.Count
For i = 1 To Application.FileSearch.FoundFiles.Count
'Me.progress = Me.progress & vbNewLine & GetFile(Application.FileSearch.FoundFiles(i))
'Me.progress = Me.progress & vbNewLine & Application.FileSearch.FoundFiles(i)
Call zapis(GetFile(Application.FileSearch.FoundFiles(i)), Application.FileSearch.FoundFiles(i))
Next i
'MsgBox "Hайдено" & vbNewLine & Me.progress 'Application.FileSearch.FoundFiles.Count
End Function
|
Public Function zapis(IMA As String, puti As String) As String
Dim dbs As DAO.Database, rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("select * from " & "Таблица5")
rst.AddNew
rst!FileName = IMA
rst!put = puti
rst.Update
rst.Close
dbs.Close
Me.table5.Requery
End Function
|
| |
|
| |