Private Sub FichImporte_GotFocus()
Dim CSql As String
Dim rst As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim intLenRep As Integer
Dim intLen As Integer
Set cnn = CurrentProject.Connection
intLenRep = Len(stRepCh)
cnn.Execute "DELETE FROM FICHIERS_TROUVES"
Set rst = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
'Active la connection de la base Access
Set rst.ActiveConnection = cnn
CSql = "FICHIERS_TROUVES;"
'Ouvre le recordset qui correspond à la table ci-dessous.
rst.Open CSql, , adOpenKeyset, adLockOptimistic
With Application.FileSearch
'Débute une nouvelle recherche
.NewSearch
'Définit les critères de recherche
.LookIn = stRepCh
.FileName = "*.*"
.SearchSubFolders = True
End With
With Application.FileSearch
'Exécute la recherche
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
'TextBox.Value = .FoundFiles(i)
intLen = Len(.FoundFiles(i))
stFichier = Right(.FoundFiles(i), intLen - intLenRep)
'Call ShowFileInfo(.FoundFiles(i))
With rst
If Right(stFichier, 11) <> "_traite.xls" Then
.AddNew
.Fields(1) = stFichier
'.Fields(2) = s
.Update
End If
End With
Next i
End If
End With
FichImporte.Requery
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE