?
Solved

how to get Word doc on top of Access

Posted on 2002-05-10
7
Medium Priority
?
283 Views
Last Modified: 2006-11-17
Hi,

I have a function in an Access 97 db that opens a (or creates a new) Word document and fills in its bookmarks with information from the database.

I recently updated the database to change some things and now when it opens/creates the Word document, Access is always visible on the screen while Word is in the background and on the task bar.  Whereas before when Word was open it was the active program (not Access).

Does anyone know what I did that made this switch?  Even a suggestion of where to look would be helpful. Does anyone know any code that will bring Word to the front and Access to the back?

Thanks for any help you can give!
emijohns
0
Comment
Question by:emijohns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Accepted Solution

by:
RichW earned 400 total points
ID: 7001722
You can use the AppActivate method to gain focus to the Word app.

Example:

Dim objWord as Object
set objWord = GetObject(,"Word.Application")
AppActivate objWord.Caption
0
 
LVL 12

Expert Comment

by:James Elliott
ID: 7001783
I use this.


 AppActivate "Microsoft Word", 1

Thanks

Jell
0
 

Author Comment

by:emijohns
ID: 7001813
I keep getting Error 5: Invalid procedure call or argument

any clue?

Just in case anyone is thinking about it...I can't set References to Word 8.0 because we have multiple platforms using this database and therefore can't reference one specific version of Word.

Will that cause problems with having AppActivate work?

Thanks!
emijohns
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 12

Expert Comment

by:Paurths
ID: 7001967
should not matter.
if u use late binding, the properties, methods and events are also available.

cheers
Ricky
0
 
LVL 4

Expert Comment

by:RichW
ID: 7002182
If you use late binding and AppActivate objWord.Caption in my example, it shouldn't matter.



0
 

Author Comment

by:emijohns
ID: 7002229
I was getting the error because of the location I put the code in.

This code worked great!  Plugged it in and was ready to go.

Thanks!
0
 
LVL 4

Expert Comment

by:RichW
ID: 7002260
Thanks emijohns.  Glad I could help.
RichW
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question