Report export to email

helper11

Registered User.
Local time
Today, 14:41
Joined
Apr 10, 2010
Messages
40
Hi all,

I have gotten a lot further on this thanks to a lot of suggestions and help from the people on this board. You can ignore my guidance question now as I have made a decision.

I have the following code which will take 2 values from list boxes and open up a report. I now want to be able to take said report and email it to a person as a rtf file. I can manually do this but wish to automatically do it, is this possible?

Here is the code I came up with incase someone can use it.

On Error GoTo Err_cmdOpenReport_Click

Dim strWhere As String

month_value = Me.Combo54.Column(1)
strWhere = "Expr1 ='" & Me.Combo52 & "' AND Expr3 = " & month_value & ""

'open the report, restricted to the selected items
DoCmd.OpenReport "Report Sales Sellers", acPreview, , strWhere

Exit_cmdOpenReport_Click:
Exit Sub

Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click

Thanks for any help on this...
 
Hello ... you can take a stab at it by looking here and here. There should be enough information to get you where you need to be. If it doesn't please post back with any problems so that we may be able to help you further.

HTH,
-dK
 
Hello,

That helped a lot. I am now stuck with one little problem. I have the user able to select the month, but all my queries and tables store it as a number. So, I have setup the combo box to select from a record with 2 columns. The first has the month in words and the second has the month as a number. I am not trying to send that number to the report. I have it as follows in the report query:

[Forms]![View Sales]![Combo3]![Column(1)]

I also tried:

[Forms]![View Sales]![Combo3].[Column(1)]

and

[Forms]![View Sales]![Combo3.Column(1)]

Any suggestions would be greatly appreciated.
 
Hi all,

Thanks again for all the help. I was able to get it to work. I added a column to the query using the monthname on the expression and that worked. I am wondering if there was any way to get the other to work using the [forms]! options. Just to have something new to learn.

Thanks again, especially dkinley for pointing me in the right direction.
 
Sorry for the delay ... I am glad that those helped you out. For your current issue, if I have it right - you should be able but use the dot reference. Forms!FormName!ComboBox.Column(n). Don't forget that the columns start at 0 for the first one, 1 for the second one, etc.

If I have it all wrong post again please.

-dK
 

Users who are viewing this thread

Back
Top Bottom