Hi,
I have a query which is run each week. It shows the download stats for a product. I'ld like to mailmerge the results, sending to each client by email.
I opened my mergedocument and recorded a macro of me manually performing the merge with the hope of copying the code into a module in access.
When I tested the macro in Word I was asked which table I wanted to merge from - it wouldn't let me open by query
The code is as follows:-
ActiveDocument.mailmerge.OpenDataSource Name:= _
"F:\Careers\ClasShare\AD Plus\adplus v99.mdb", ConfirmConversions:=True, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:="QUERY stats", SQLStatement:="SELECT * FROM [stats]", _
SQLStatement1:="", SubType:=wdMergeSubTypeOther
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
End Sub
Am I trying to tackle this the correct way? I don't have much knowledge of VB or Access so am not really sure.
If I can resolve this issue I guess that I'll create a form that runs the query and then generates the mailmerge...that's if I get that far!
The query shows the download stats for a particular week - thus the result of the query changes each week.
Any help would be greatly appreciated!
thanks
Barry
I have a query which is run each week. It shows the download stats for a product. I'ld like to mailmerge the results, sending to each client by email.
I opened my mergedocument and recorded a macro of me manually performing the merge with the hope of copying the code into a module in access.
When I tested the macro in Word I was asked which table I wanted to merge from - it wouldn't let me open by query
The code is as follows:-
ActiveDocument.mailmerge.OpenDataSource Name:= _
"F:\Careers\ClasShare\AD Plus\adplus v99.mdb", ConfirmConversions:=True, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:="QUERY stats", SQLStatement:="SELECT * FROM [stats]", _
SQLStatement1:="", SubType:=wdMergeSubTypeOther
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
End Sub
Am I trying to tackle this the correct way? I don't have much knowledge of VB or Access so am not really sure.
If I can resolve this issue I guess that I'll create a form that runs the query and then generates the mailmerge...that's if I get that far!
The query shows the download stats for a particular week - thus the result of the query changes each week.
Any help would be greatly appreciated!
thanks
Barry