patriciaxxx
Programmer
I have 2 problems when I open my form and run the code below
First I want to modify my code to include a msgbox showing how many records were added
Second I need my code modified so the form shows the new records once its finished running
This is my code
Private Sub cmdLoad_Click()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
'Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow the user to make multiple selections in the dialog box.
.AllowMultiSelect = True
'Set the title of the dialog box.
.TITLE = "Select One or More Files"
'Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "Access Databases", "*.MDB"
.Filters.Add "Access Projects", "*.ADP"
.Filters.Add "All Files", "*.*"
'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
'Loop through each file that is selected and then add it to the list box.
For Each varFile In .SelectedItems
InsertBLOB varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
First I want to modify my code to include a msgbox showing how many records were added
Second I need my code modified so the form shows the new records once its finished running
This is my code
Private Sub cmdLoad_Click()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
'Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow the user to make multiple selections in the dialog box.
.AllowMultiSelect = True
'Set the title of the dialog box.
.TITLE = "Select One or More Files"
'Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "Access Databases", "*.MDB"
.Filters.Add "Access Projects", "*.ADP"
.Filters.Add "All Files", "*.*"
'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
'Loop through each file that is selected and then add it to the list box.
For Each varFile In .SelectedItems
InsertBLOB varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub