This is not a job for a macro. If your invoice "template" is a single
view form, you can set the Default Value property of the InvoiceNumber
textbox to the equivalent of...
DMax("[InvoiceNumber]","Invoices")+1
(obviously substitute the names of your own actual table and field
names).