Call Link to MS Word from a User-defined Menu

L

LPC

Hi All, please help me with this problem.
I have a database that has its own Menu and Submenus, and a document in Word
that uses Mail Merge data from this database (I could have created a report
for this document, but, as far as I know, Access does not have the JUSTIFIED
ALIGNMENT feature (alignment both to the left and the right, as in MS Word,
so I decided to leave it in MS Word). What I want to do is to have a command
in the MENU showing the link to this document in Word, which should be open
ONLY FOR THE RECORD CORRESPONDING TO THAT ONE I AM CURRENTLY HAVING IN MS
ACCESS DATABASE (filtered).
Thanks for any help
 
I

Ilan

Hello,
you are in luck, i have done the same thing. First of
all create a macro with the action "RunApp." Then in the
command line, enter the directory extension for Microsoft
Word (It can be found through start --> run. It looks
something like this:
"c:/program files/office10/winword.exe").

Directly after the directory for Word, enter the
directory location for the document. Again - something
like this:
"c:/my documents/document1.doc"

Save the macro.

Go into the form design view and open the toolbox. From
there create a new command button. The wizard will come
up and under categories, select misc. and in the right
hand column click run macro. From there, follow the
steps for the command button to be linked to macro you
just created.

NOW, go to the query that is attached to the Word
document. In the criteria for one of the fields
(preferably an id field or something like that) Write the
following code:

[Forms]![NameOfForm]![NameOfField]

Mine looked something like this:
[Forms]![Client_Info]![ID]

So after all that, if you go to your form and click the
new button you made, it should pass all your info to word
and then all you have to do is merge it and you will get
your one record.

Hope that helps,
Ilan
 
L

LPC

Hi Ilan,
Thank you very much for having replied to my question. As I am currently on
travel for a few days, I would follow your instructions as soon as I get back
and I´ll let you know of the result. Once again, lots of thank.
Regards,
LPC

Ilan said:
Hello,
you are in luck, i have done the same thing. First of
all create a macro with the action "RunApp." Then in the
command line, enter the directory extension for Microsoft
Word (It can be found through start --> run. It looks
something like this:
"c:/program files/office10/winword.exe").

Directly after the directory for Word, enter the
directory location for the document. Again - something
like this:
"c:/my documents/document1.doc"

Save the macro.

Go into the form design view and open the toolbox. From
there create a new command button. The wizard will come
up and under categories, select misc. and in the right
hand column click run macro. From there, follow the
steps for the command button to be linked to macro you
just created.

NOW, go to the query that is attached to the Word
document. In the criteria for one of the fields
(preferably an id field or something like that) Write the
following code:

[Forms]![NameOfForm]![NameOfField]

Mine looked something like this:
[Forms]![Client_Info]![ID]

So after all that, if you go to your form and click the
new button you made, it should pass all your info to word
and then all you have to do is merge it and you will get
your one record.

Hope that helps,
Ilan


-----Original Message-----
Hi All, please help me with this problem.
I have a database that has its own Menu and Submenus, and a document in Word
that uses Mail Merge data from this database (I could have created a report
for this document, but, as far as I know, Access does not have the JUSTIFIED
ALIGNMENT feature (alignment both to the left and the right, as in MS Word,
so I decided to leave it in MS Word). What I want to do is to have a command
in the MENU showing the link to this document in Word, which should be open
ONLY FOR THE RECORD CORRESPONDING TO THAT ONE I AM CURRENTLY HAVING IN MS
ACCESS DATABASE (filtered).
Thanks for any help
.
 
L

LPC

Hi Ilan,
I followed your instructions and it works brillantly, for the first phase
(call Word and open the document), but as to the filtered records, I still
have problem because my Word document is a Main Merge document (it already
contains the record source from the database, with the fields picked up and
set in place). What I want is to open this document and it directly goes to
the record I have in the form (not the procedure that you indicated me,
namely to pass the information to Word before merging it). I have tried to
select the record source that is a Query with criteria, but Word seems not to
recognize these Queries (they do not appear in the list of tables and queries
of the source database). So, the result I have so far is that I can open that
document from my database, but I still have to search for the record that I
want "manually" in Word. If you, or anyone else, can help me figure out this
problem, I would much appreciate it.

Thanks in advance,

LPC
 
L

LPC

Hi, I've found the answer.

To open the word document and merge it immediately from Access, I changed
the query type from Selection query to Make-Table Query. The table created by
that database then will serve as the source table for the word document.
That's all.

LPC
 

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