Mail Merge from Access with datasource being a password protected

R

Rose B

I have an Access application distributed to users of Office 2003 and Office
2007 via a runtime front end. The application needs to trigger a Mail Merge
which will use query results in back end, which is protected by a password.

I have coded in VB to cope with this in an Office 2007 environment - but
when running with Office 2003 Word is asking for the data source when
initially opening the mail merge document from Accesss; when opened directly
it does not ask for the data source and when responding with "No" to the SQL
prompt it opens fine. Can anyone help?

My code is

With myWordDoc.MailMerge
.OpenDataSource Name:="", ConfirmConversions:=False,
ReadOnly:=False, LinkToSource:=False, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=0, _
Connection:="DSN=MS Access Database;DBQ=" & DataSource &
";DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;PWD=mypassword;UID=admin;" _
, SQLStatement:=mySQL, SQLStatement1:="", SubType:=1
.Destination = myDestination
.MailAddressFieldName = "Email"
.ViewMailMergeFieldCodes = False
.SuppressBlankLines = True
With .DataSource
.FirstRecord = 1
.LastRecord = -16
End With
.Execute Pause:=False
End With
 
T

tom_willpa

high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price? China
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are
the best brand replica goods whih are look the same as the original goods.
excellent quality and steady supply for them. we have been marketed in Europe
and American for 3 year. all the goods we offer are AAA quality. our soccer
jersey are Thailand style. If any goods you buy from my company have problem,
we will refund or resend them again. Most of ourProducts have no minimum
order requirements,soyou can shop retail goods at wholesale prices. if you
can buy more than 300usd. We offer free shipping. The more you buy the more
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping. 7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
 
P

pietlinden

I have an Access application distributed to users of Office 2003 and Office
2007 via a runtime front end. The application needs to trigger a Mail Merge
which will use query results in back end, which is protected by a password.

I have coded in VB to cope with this in an Office 2007 environment - but
when running with Office 2003 Word is asking for the data source when
initially opening the mail merge document from Accesss; when opened directly
it does not ask for the data source and when responding with "No" to the SQL
prompt it opens fine. Can anyone help?

My code is

    With myWordDoc.MailMerge
        .OpenDataSource Name:="", ConfirmConversions:=False,
ReadOnly:=False, LinkToSource:=False, _
           AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
           WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
           Format:=0, _
           Connection:="DSN=MS Access Database;DBQ=" & DataSource &
";DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;PWD=mypassword;UID=admin;" _
           , SQLStatement:=mySQL, SQLStatement1:="", SubType:=1
         .Destination = myDestination
         .MailAddressFieldName = "Email"
         .ViewMailMergeFieldCodes = False
         .SuppressBlankLines = True
            With .DataSource
                .FirstRecord = 1
                .LastRecord = -16
            End With
         .Execute Pause:=False
    End With

What if you used Albert's code for Super Easy Word Merge? Because it
exports to a delimited text file, you could use that as the source and
not have to deal with the security issues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top