maijaz
07-07-2008, 04:35 PM
Hi,
I need an expert advice, I am tryin to email a report via access database but with the filename as the customer name in the attachment of outlook client. My code looks ugly now as i m tryin many solutions but cannot able to change the filename as the compnay name
Dim stDocName As String
Dim AttchName As String
Dim fname As String
Forms.Caption = [Forms]![Customers].[Company_Name]
Rem AttchName = Replace(DLookup("Company_Name", "Customers", "[Cust Number]=" & [Forms]![Customers].[Customer ID]), Space(1), "_")
Rem fname = [Forms]![Customers].[Company_Name]
stDocName = "CustomersQuery"
DoCmd.OpenReport stDocName, acPreview
DoCmd.SendObject acSendReport, stDocName, acFormatSNP
Rem DoCmd.CopyObject , AttchName, acReport, stDocName
Rem DoCmd.SendObject acReport, AttchName, acFormatSNP
Rem DoCmd.SetWarnings False
Rem DoCmd.DeleteObject acReport, AttchName
Rem DoCmd.SetWarnings True
I need an expert advice, I am tryin to email a report via access database but with the filename as the customer name in the attachment of outlook client. My code looks ugly now as i m tryin many solutions but cannot able to change the filename as the compnay name
Dim stDocName As String
Dim AttchName As String
Dim fname As String
Forms.Caption = [Forms]![Customers].[Company_Name]
Rem AttchName = Replace(DLookup("Company_Name", "Customers", "[Cust Number]=" & [Forms]![Customers].[Customer ID]), Space(1), "_")
Rem fname = [Forms]![Customers].[Company_Name]
stDocName = "CustomersQuery"
DoCmd.OpenReport stDocName, acPreview
DoCmd.SendObject acSendReport, stDocName, acFormatSNP
Rem DoCmd.CopyObject , AttchName, acReport, stDocName
Rem DoCmd.SendObject acReport, AttchName, acFormatSNP
Rem DoCmd.SetWarnings False
Rem DoCmd.DeleteObject acReport, AttchName
Rem DoCmd.SetWarnings True