lookforsmt
Registered User.
- Local time
- Tomorrow, 02:13
- Joined
- Dec 26, 2011
- Messages
- 672
HI!
Below code is to copies the file names from a folder to table in access. This codes works well with one message "file name imported"
I need to put a popup message for the below
a) Do you want to copy the file names, "Yes/No" yes will continue and no will stop the code and do nothing.
b)if yes then display in popup message the names of files copied
b) if the same file names are copied earlier then the popup msg to alert "file names already copied"
below is the code
I am not sure where to put the popup message code. Any suggestions
Below code is to copies the file names from a folder to table in access. This codes works well with one message "file name imported"
I need to put a popup message for the below
a) Do you want to copy the file names, "Yes/No" yes will continue and no will stop the code and do nothing.
b)if yes then display in popup message the names of files copied
b) if the same file names are copied earlier then the popup msg to alert "file names already copied"
below is the code
Code:
Private Sub cmdImport_FileName_Click()
On Error GoTo Err_Handler_1
Dim folderspec As String
Dim fs, f, f1, fc, s
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tbl_Imported_FileName")
folderspec = "E:\Import\Folder1\Daily download folder\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
rs.AddNew
rs.Fields("File_Name") = f1.Name
rs.Update
Next
MsgBox f1 & " " & "file name Imported"
Set rs = Nothing
Exit_Handler:
Exit Sub
Err_Handler_1:
If Err = 3022 Then
Resume Next 'tells the routine to ignore error and continue
Else
MsgBox "Error " & Err.Number & " cmdImport_FileName_Click procedure : " & vbCrLf & Err.Description
End If
End Sub