Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add msgbox with count of new records added + refresh form to show new records

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
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
 
This looks like it is related to your other post. If you want to message how many records were added by your InsertBlob function, make the record count the return value of your InsertBlob function and then:

Msgbox InsertBlob(varFile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top