Reply
 
Thread Tools Display Modes
  #1   Report Post  
Roger
 
Posts: n/a
Default Mail Merge to a secured Access database

I would like to reference an mdb file for a mail merge. However, the db is
secured with an mdw file. I've tried referencing the workgroup file, but was
unsuccessful. I would imagine it would work if I gave the Access "Admin"
userid read access. Is there a way to do the merge without making changes to
the workgroup security settings? Thanks!
--
Roger
  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

Which version of Word, and how did you try to reference the workgroup file?

Here are a few notes I wrote a few months ago. These
notes definitely apply to Word 2000 but things may be significantly
different in later versions (Word 2003 in particular).

The main points a
a. I do not think you can connect to a workgroup-database secured .mdb
using DDE (i.e. the default connection method in Word 2000 and earlier)
b. you can connect using ODBC, but if you want to connect using the Word
user interface or MS Query, you must use an ODBC DSN (Data Source Name) that
specifies the workgroup database. If you do not, neither Word nor MS Query
will let you connect at all.
c. if you do not also specify a login name and password in the DSN, Word
should prompt you for your login details when you first connect.
d. you can connect programmatically using VBA and a suitable connect
string, again specifying a DSN, the login name and password. In this case
you do not have to create a new DSN - you can use the default "MS Access
Database" DSN and add the necessary information about the workgroup file in
the connection string.

As for DSNs, there are three types:
a. User DSNs, available to a particular user on a particular PC
b. System DSNs, available to all users on a particular PC
c. File DSNs, available to anyone with access to the .dsn file (e.g. it can
be on a network share) with the proviso that the ODBC driver referenced by
the .dsn must be installed on the system that is attempting to use that
..dsn.

The settings for User and File DSNs are stored in the Windows registry and
are collectively known as Machine DSNs.

All types of DSN can be created using the ODBC Administrator. This can
typically be found in Control Panel, and in Win2K/WinXP you need to look in
the Administrative Tools folder. In principal you could modify the default
DSN for Access ("MS Access Database") to specify a particular workgroup file
etc., but personally I think it is better practice to leave default values
as they are and create a new DSN.

When you create an Access DSN for use with a workgroup file, you can use the
Advanced... button to specify a login name and password. However, notice
that when you create a /file/ DSN using this method, the ODBC Administrator
saves the login name but not the login password. You can edit the file in
Notepad to add

PWD=thepassword

if you want.

You can also create /file/ DSNs in MS Query, and in this case the password
will be saved if you check the appropriate button.

If you decide to use the Word VBA OpenDataSource method to open an ODBC
Access data source, you need 3 parameters:
a. set Name to "" for Machine DSNs, and to the full path name of the .dsn
file for file DSNs (actually, it does not have to be to this file but it is
the easiest way to do it)
b. set Connection to "DSN=theDSNname;" for Machine DSNs, and to
"FILEDSN=thefullpathnameof theDSNfile;" for File DSNs. Append any
information not contained in the DSN.
c. set SQLStatement to the SQL query string you need. If it is a long
string, you may need to use SQLStatement1 as well, in which case just split
the SQL statement at any part but ensure that the two strings concatenated
constitute valie SQL (i.e. make sure there is a space at the end of
SQLStatement or the beginning of SQLStatement1 is one is syntactically
required.
d. in Word 2002 and later you will need to add the parameter
Subtype:=wdMergeSubtypeWord200*0, at least when using Machine DSNs

Examples of OpenDataSource calls:-

With Machine DSN

ActiveDocument.MailMerge.OpenD*ataSource _
Name:="", _
Connection:="DSN=mydsn;DBQ=c:\*mydbs\x.mdb;" _
&
"SystemDB=c:\mywgdb\Secured.md*w;UID=myloginname;P WD=mypasswo*rd", _
SQLStatement:="SELECT * FROM `mytable`"

With File DSN

ActiveDocument.MailMerge.OpenD*ataSource _
Name:="c:\mydsns\x.dsn", _
Connection:="FILEDSN=c:\mydsns*\x.dsn;DBQ=c:\mydbs \x.mdb;" _
&
"SystemDB=c:\mywgdb\Secured.md*w;UID=myloginname;P WD=mypasswo*rd", _
SQLStatement:="SELECT * FROM `mytable`"

If you are using Word 2002 or later, you should still be able to use ODBC.
But you can also connect using OLEDB, and in that case what you need is
either a .udl file with an OLEDB connection string that specifies the
workgroup database etc., or a .odc file containing much the same thing. You
should be able to create a suitable .odc file using the "New Source" button
in the Word Select Data Source dialog box. If you try to open the .mdb by
specifying the .mdb as the data source, you will see a dialog box similar to
the one used to create a .odc, but beware, because filling this dialog in
will not have the same effect as creating a .odc and using that as the data
source.

"Roger" wrote in message
...
I would like to reference an mdb file for a mail merge. However, the db is
secured with an mdw file. I've tried referencing the workgroup file, but
was
unsuccessful. I would imagine it would work if I gave the Access "Admin"
userid read access. Is there a way to do the merge without making changes
to
the workgroup security settings? Thanks!
--
Roger



  #3   Report Post  
Roger
 
Posts: n/a
Default

Thank you for the detailed answer! I'm using Word 2003 and it is obvious I
referenced the mdw file incorrectly. You have given me enough info to move
forward. Thanks again!

"Peter Jamieson" wrote:

Which version of Word, and how did you try to reference the workgroup file?

Here are a few notes I wrote a few months ago. These
notes definitely apply to Word 2000 but things may be significantly
different in later versions (Word 2003 in particular).

The main points a
a. I do not think you can connect to a workgroup-database secured .mdb
using DDE (i.e. the default connection method in Word 2000 and earlier)
b. you can connect using ODBC, but if you want to connect using the Word
user interface or MS Query, you must use an ODBC DSN (Data Source Name) that
specifies the workgroup database. If you do not, neither Word nor MS Query
will let you connect at all.
c. if you do not also specify a login name and password in the DSN, Word
should prompt you for your login details when you first connect.
d. you can connect programmatically using VBA and a suitable connect
string, again specifying a DSN, the login name and password. In this case
you do not have to create a new DSN - you can use the default "MS Access
Database" DSN and add the necessary information about the workgroup file in
the connection string.

As for DSNs, there are three types:
a. User DSNs, available to a particular user on a particular PC
b. System DSNs, available to all users on a particular PC
c. File DSNs, available to anyone with access to the .dsn file (e.g. it can
be on a network share) with the proviso that the ODBC driver referenced by
the .dsn must be installed on the system that is attempting to use that
..dsn.

The settings for User and File DSNs are stored in the Windows registry and
are collectively known as Machine DSNs.

All types of DSN can be created using the ODBC Administrator. This can
typically be found in Control Panel, and in Win2K/WinXP you need to look in
the Administrative Tools folder. In principal you could modify the default
DSN for Access ("MS Access Database") to specify a particular workgroup file
etc., but personally I think it is better practice to leave default values
as they are and create a new DSN.

When you create an Access DSN for use with a workgroup file, you can use the
Advanced... button to specify a login name and password. However, notice
that when you create a /file/ DSN using this method, the ODBC Administrator
saves the login name but not the login password. You can edit the file in
Notepad to add

PWD=thepassword

if you want.

You can also create /file/ DSNs in MS Query, and in this case the password
will be saved if you check the appropriate button.

If you decide to use the Word VBA OpenDataSource method to open an ODBC
Access data source, you need 3 parameters:
a. set Name to "" for Machine DSNs, and to the full path name of the .dsn
file for file DSNs (actually, it does not have to be to this file but it is
the easiest way to do it)
b. set Connection to "DSN=theDSNname;" for Machine DSNs, and to
"FILEDSN=thefullpathnameof theDSNfile;" for File DSNs. Append any
information not contained in the DSN.
c. set SQLStatement to the SQL query string you need. If it is a long
string, you may need to use SQLStatement1 as well, in which case just split
the SQL statement at any part but ensure that the two strings concatenated
constitute valie SQL (i.e. make sure there is a space at the end of
SQLStatement or the beginning of SQLStatement1 is one is syntactically
required.
d. in Word 2002 and later you will need to add the parameter
Subtype:=wdMergeSubtypeWord200¬*0, at least when using Machine DSNs

Examples of OpenDataSource calls:-

With Machine DSN

ActiveDocument.MailMerge.OpenD¬*ataSource _
Name:="", _
Connection:="DSN=mydsn;DBQ=c:\¬*mydbs\x.mdb;" _
&
"SystemDB=c:\mywgdb\Secured.md¬*w;UID=myloginname; PWD=mypasswo¬*rd", _
SQLStatement:="SELECT * FROM `mytable`"

With File DSN

ActiveDocument.MailMerge.OpenD¬*ataSource _
Name:="c:\mydsns\x.dsn", _
Connection:="FILEDSN=c:\mydsns¬*\x.dsn;DBQ=c:\mydb s\x.mdb;" _
&
"SystemDB=c:\mywgdb\Secured.md¬*w;UID=myloginname; PWD=mypasswo¬*rd", _
SQLStatement:="SELECT * FROM `mytable`"

If you are using Word 2002 or later, you should still be able to use ODBC.
But you can also connect using OLEDB, and in that case what you need is
either a .udl file with an OLEDB connection string that specifies the
workgroup database etc., or a .odc file containing much the same thing. You
should be able to create a suitable .odc file using the "New Source" button
in the Word Select Data Source dialog box. If you try to open the .mdb by
specifying the .mdb as the data source, you will see a dialog box similar to
the one used to create a .odc, but beware, because filling this dialog in
will not have the same effect as creating a .odc and using that as the data
source.

"Roger" wrote in message
...
I would like to reference an mdb file for a mail merge. However, the db is
secured with an mdw file. I've tried referencing the workgroup file, but
was
unsuccessful. I would imagine it would work if I gave the Access "Admin"
userid read access. Is there a way to do the merge without making changes
to
the workgroup security settings? Thanks!
--
Roger




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
mail merge - Access 2000 and Word 2000 DawnMKA Mailmerge 1 March 26th 05 11:20 AM
why word 2000 mail merge opens multiple instances of access table. Johnny C. Mailmerge 0 February 3rd 05 05:11 PM
Using as secured Access database as the data source for a mail mer Carmine Mailmerge 1 December 10th 04 05:25 PM
Word mail merge with Access Linda Mailmerge 1 December 7th 04 11:46 PM
Word mail merge doesn't pick up the addresses in Access database. Julie Tables 1 November 24th 04 01:26 AM


All times are GMT +1. The time now is 07:43 PM.

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

About Us

"It's about Microsoft Word"