Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2006

Tip: Looking for answers? Try searching our database.

Access Source

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LDanix - 11 Aug 2006 20:25 GMT
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.
LMiller - 12 Aug 2006 23:31 GMT
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

> 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.
Cindy M. - 13 Aug 2006 09:45 GMT
Hi =?Utf-8?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 :-)
LDanix - 14 Aug 2006 14:09 GMT
> Hi =?Utf-8?B?TERhbml4?=,
>
[quoted text clipped - 19 lines]
> 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?
Cindy M. - 15 Aug 2006 10:14 GMT
Hi =?Utf-8?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
[quoted text clipped - 22 lines]
>  
> 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 :-)
LDanix - 16 Aug 2006 14:07 GMT
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?
Cindy M. - 17 Aug 2006 14:37 GMT
Hi =?Utf-8?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 :-)
LDanix - 17 Aug 2006 22:46 GMT
> Hi =?Utf-8?B?TERhbml4?=,
>
[quoted text clipped - 20 lines]
> 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?
Cindy M. - 18 Aug 2006 09:46 GMT
Hi =?Utf-8?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 :-)
LDanix - 23 Aug 2006 15:42 GMT
That did it! Thank you for your help and patience.

> Hi =?Utf-8?B?TERhbml4?=,
>
[quoted text clipped - 20 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M. - 24 Aug 2006 10:15 GMT
Hi =?Utf-8?B?TERhbml4?=,

> That did it!

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

   Cindy Meister
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.