#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default Access Source

I am using an Access table as my source for a mail merge. The database has a
password on it. Is there a way to use VBA to have it automatically enter the
password when it is opened?
I have a form in Access that contains a button that executes the open and
mailmerge commands on the Word document file.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LMiller LMiller is offline
external usenet poster
 
Posts: 3
Default Access Source

Sounds like we may be working on something similar. I'm stuck too. I'm
working on a "form filler" with Access as the source that will print multiple
documents when complete. How did you create the control buttons to print from
Access? Can you print 2 at a time? How about reprinting specific documents
if necessary instead of all of them. If you have any insight to the problem,
I sure would appreciate a response. Thanks

"LDanix" wrote:

I am using an Access table as my source for a mail merge. The database has a
password on it. Is there a way to use VBA to have it automatically enter the
password when it is opened?
I have a form in Access that contains a button that executes the open and
mailmerge commands on the Word document file.

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Access Source

Hi ?B?TERhbml4?=,

I am using an Access table as my source for a mail merge. The database has a
password on it. Is there a way to use VBA to have it automatically enter the
password when it is opened?

I think this can be done using an ODBC connection and supplying the password
with the PWD parameter.

If you don't know how to explicitly select a connection method, you need to
tell us the version of Office you're working with.

Then try recording connecting to the Access database in a macro. If you need
further help, after this point, we need to see the OpenDataSource the macro
recorder created.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default Access Source



"Cindy M." wrote:

Hi ?B?TERhbml4?=,

I am using an Access table as my source for a mail merge. The database has a
password on it. Is there a way to use VBA to have it automatically enter the
password when it is opened?

I think this can be done using an ODBC connection and supplying the password
with the PWD parameter.

If you don't know how to explicitly select a connection method, you need to
tell us the version of Office you're working with.

Then try recording connecting to the Access database in a macro. If you need
further help, after this point, we need to see the OpenDataSource the macro
recorder created.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)


Here is the code that is currently in the Word document VBA:

Private Sub Document_Open()
Me.MailMerge.OpenDataSource
"\\calumet\apps\asset_tracking_system\Current Employee.odc"
Me.MailMerge.ViewMailMergeFieldCodes = False
Me.MailMerge.Destination = wdSendToNewDocument
Me.MailMerge.Execute
Me.Close
End Sub

Where do I add code to enter the password?
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Access Source

Hi ?B?TERhbml4?=,

I am using an Access table as my source for a mail merge. The database has a
password on it. Is there a way to use VBA to have it automatically enter the
password when it is opened?

I think this can be done using an ODBC connection and supplying the password
with the PWD parameter.

If you don't know how to explicitly select a connection method, you need to
tell us the version of Office you're working with.

Then try recording connecting to the Access database in a macro. If you need
further help, after this point, we need to see the OpenDataSource the macro
recorder created.

Here is the code that is currently in the Word document VBA:

Private Sub Document_Open()
Me.MailMerge.OpenDataSource
"\\calumet\apps\asset_tracking_system\Current Employee.odc"
Me.MailMerge.ViewMailMergeFieldCodes = False
Me.MailMerge.Destination = wdSendToNewDocument
Me.MailMerge.Execute
Me.Close
End Sub

Where do I add code to enter the password?

You don't. Please re-read my original message and answer the questions I asked.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :-)



  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default Access Source

Sorry, I thought the PWD parameter was something that could be added to that
code.
I am using Office 2003. Do I start recording the macro in Word?
  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Access Source

Hi ?B?TERhbml4?=,

Sorry, I thought the PWD parameter was something that could be added to that
code.

OLE DB is fussy; ODBC is more predictable. The code you showed me wants, in
adddition, to use an secondary *.odc file. These are not well documented and
it's difficult to get them to do what you think they ought to.

I am using Office 2003. Do I start recording the macro in Word?

Yes :-)

In order to control the connection method in Word 2003, activate "Confirm
conversions on open" in Tools/Options/General. This will show you a list once
you've selected the file containing the data.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default Access Source



"Cindy M." wrote:

Hi ?B?TERhbml4?=,

Sorry, I thought the PWD parameter was something that could be added to that
code.

OLE DB is fussy; ODBC is more predictable. The code you showed me wants, in
adddition, to use an secondary *.odc file. These are not well documented and
it's difficult to get them to do what you think they ought to.

I am using Office 2003. Do I start recording the macro in Word?

Yes :-)

In order to control the connection method in Word 2003, activate "Confirm
conversions on open" in Tools/Options/General. This will show you a list once
you've selected the file containing the data.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)


I opened the database as ODBC. After saving the document, I reopened the
database and tried executing the command from the form with the button. Same
thing. Am I getting ahead of you? What do I do after selecting ODBC when I
open the database as the source file?
  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Access Source

Hi ?B?TERhbml4?=,

I opened the database as ODBC. After saving the document, I reopened the
database and tried executing the command from the form with the button. Same
thing. Am I getting ahead of you? What do I do after selecting ODBC when I
open the database as the source file?

In my original response I said:

Then try recording connecting to the Access database in a macro. If you need
further help, after this point, we need to see the OpenDataSource the macro
recorder created.

The point is to get the connection information Word requires for an ODBC
connection, which will include a PWD (password) parameter. Then use this in
your code, rather than what you already have.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #10   Report Post  
Posted to microsoft.public.word.mailmerge.fields
LDanix LDanix is offline
external usenet poster
 
Posts: 14
Default Access Source

That did it! Thank you for your help and patience.

"Cindy M." wrote:

Hi ?B?TERhbml4?=,

I opened the database as ODBC. After saving the document, I reopened the
database and tried executing the command from the form with the button. Same
thing. Am I getting ahead of you? What do I do after selecting ODBC when I
open the database as the source file?

In my original response I said:

Then try recording connecting to the Access database in a macro. If you need
further help, after this point, we need to see the OpenDataSource the macro
recorder created.

The point is to get the connection information Word requires for an ODBC
connection, which will include a PWD (password) parameter. Then use this in
your code, rather than what you already have.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)




  #11   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Access Source

Hi ?B?TERhbml4?=,

That did it!

Great :-)! Thanks for letting us know it worked.

Cindy Meister

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2000 mail merge documents won't save Access 2000 data source Andy C Mailmerge 1 May 17th 06 08:39 AM
Access query as a mailmerge source Stephen Glynn New Users 2 February 7th 06 09:30 PM
Using Access as a Merge Source Stephen Glynn New Users 1 January 25th 06 01:45 PM
Mailmerge data source in an Access database will not open Colin C Mailmerge 3 December 31st 04 12:01 AM
Using as secured Access database as the data source for a mail mer Carmine Mailmerge 1 December 10th 04 05:25 PM


All times are GMT +1. The time now is 08:53 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"