Quantcast
Viewing all articles
Browse latest Browse all 38405

Need help with some VBA code

This a long shot I know, but if anyone is handy with a bit of code I really appreicate a bit of help.

Here goes working in Access 2010:
frmInvoices has a command button which prints a rptInvoice based on [InvoiceNo] the code behind it is:

If Me.Dirty Then
Me.Dirty = False
End If
Dim strfrmInvoices As String
Dim strWhere As String
strfrmInvoices = "rptInvoice"
strWhere = "[InvoiceNo]=" & Me!InvoiceNo
DoCmd.OpenReport strfrmInvoices, acPreview, , strWhere

That's fine when all I want to do is print an invoice. But I would like to be able to email in pdf format sometimes too. So I like a command button to select a report based on [InvoiceNo] save that report as Invoice No[InvoiceNo] & date in PDF format and attach it to an email. It doesn't really matter if the email address is filled out but if possible it would be great.

Anyone any idea if this is possible and what code I'd need to make it work?
Thanks in advance

Viewing all articles
Browse latest Browse all 38405

Trending Articles