thutchinson
asked on
Use MsgBox to display the number of records imported
DCount-example.txt
Hi Experts,
I have a module that imports invoice line item details from an Excel file. At the completion of the import I would like to display the number of records successfully imported into a table named "Invoices". I was using the ImportDate field to specify the records to count. Here's what I was trying:
'MsgBox DCount("*", "Invoices", "ImportDate = #" & Date & "#") & " records imported into Invoices table", vbInformation, "Import"
The MsgBox returns "0 records imported into Invoices table" which is incorrect. All records are being imported correctly. Is someone able to help me with my syntax? The full text of the module is attached in case anyone wishes to offer additional comments or improvements. Thanks.
Hi Experts,
I have a module that imports invoice line item details from an Excel file. At the completion of the import I would like to display the number of records successfully imported into a table named "Invoices". I was using the ImportDate field to specify the records to count. Here's what I was trying:
'MsgBox DCount("*", "Invoices", "ImportDate = #" & Date & "#") & " records imported into Invoices table", vbInformation, "Import"
The MsgBox returns "0 records imported into Invoices table" which is incorrect. All records are being imported correctly. Is someone able to help me with my syntax? The full text of the module is attached in case anyone wishes to offer additional comments or improvements. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi DatabaseMX.
Your suggestion didn't work. In fact, now I don't get the Msgbox at all. Instead the error trapping message kicks in and says it doesn't recognize a field (although all records were imported successfully.
Your suggestion didn't work. In fact, now I don't get the Msgbox at all. Instead the error trapping message kicks in and says it doesn't recognize a field (although all records were imported successfully.
MsgBox DCount("*", "Invoices", "ImportDate = #" & DateValue([Date]) & "#") & " records imported into Invoices table", vbInformation, "Import"
This assumes Date cannot be Null ...