Reply
 
Thread Tools Display Modes
  #1   Report Post  
Slow Learner
 
Posts: n/a
Default Opening Access from Word

I have a Word document which I wish to have close and open an Access Database
form.

This is the code I have put cmdAccess1 Click which shows under
Project(Viable) Microsoft Word Objects:

Private Sub cmdAccess1_Click()

On Error GoTo Err_cmdAccess1_Click

Dim oApp As Object

Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.Database.Open "c:\test\access\TEST.mdb"


Exit_cmdAccess1_Click:
Exit Sub

Err_cmdAccess1_Click:
MsgBox Err.Description
Resume Exit_cmdAccess1_Click

End Sub

If all went well and the Access database would open and at a Switchboard
form for the user to navigate through and close the Word program.
Best would be to have it reopen the form that it came from in the database
as there is a command button in Access which opens this report. Have no idea
how to do this but the code above is my start.





  #2   Report Post  
Slow Learner
 
Posts: n/a
Default

Do you know how to do this? Can you give me any suggestions

"Slow Learner" wrote:

I have a Word document which I wish to have close and open an Access Database
form.

This is the code I have put cmdAccess1 Click which shows under
Project(Viable) Microsoft Word Objects:

Private Sub cmdAccess1_Click()

On Error GoTo Err_cmdAccess1_Click

Dim oApp As Object

Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.Database.Open "c:\test\access\TEST.mdb"


Exit_cmdAccess1_Click:
Exit Sub

Err_cmdAccess1_Click:
MsgBox Err.Description
Resume Exit_cmdAccess1_Click

End Sub

If all went well and the Access database would open and at a Switchboard
form for the user to navigate through and close the Word program.
Best would be to have it reopen the form that it came from in the database
as there is a command button in Access which opens this report. Have no idea
how to do this but the code above is my start.





  #3   Report Post  
Graham Mayor
 
Posts: n/a
Default

As my name appears in the subject, I guess you intend an answer from me;
however I know nothing about Access so cannot assist.
Try an Access and/or vba newsgroup.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Slow Learner wrote:
Do you know how to do this? Can you give me any suggestions

"Slow Learner" wrote:

I have a Word document which I wish to have close and open an Access
Database form.

This is the code I have put cmdAccess1 Click which shows under
Project(Viable) Microsoft Word Objects:

Private Sub cmdAccess1_Click()

On Error GoTo Err_cmdAccess1_Click

Dim oApp As Object

Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.Database.Open "c:\test\access\TEST.mdb"


Exit_cmdAccess1_Click:
Exit Sub

Err_cmdAccess1_Click:
MsgBox Err.Description
Resume Exit_cmdAccess1_Click

End Sub

If all went well and the Access database would open and at a
Switchboard form for the user to navigate through and close the Word
program.
Best would be to have it reopen the form that it came from in the
database as there is a command button in Access which opens this
report. Have no idea how to do this but the code above is my start.



  #4   Report Post  
Slow Learner
 
Posts: n/a
Default

Thanks and yes I thought maybe you could shed some light on how to do this in
the Word program.

"Graham Mayor" wrote:

As my name appears in the subject, I guess you intend an answer from me;
however I know nothing about Access so cannot assist.
Try an Access and/or vba newsgroup.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Slow Learner wrote:
Do you know how to do this? Can you give me any suggestions

"Slow Learner" wrote:

I have a Word document which I wish to have close and open an Access
Database form.

This is the code I have put cmdAccess1 Click which shows under
Project(Viable) Microsoft Word Objects:

Private Sub cmdAccess1_Click()

On Error GoTo Err_cmdAccess1_Click

Dim oApp As Object

Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.Database.Open "c:\test\access\TEST.mdb"


Exit_cmdAccess1_Click:
Exit Sub

Err_cmdAccess1_Click:
MsgBox Err.Description
Resume Exit_cmdAccess1_Click

End Sub

If all went well and the Access database would open and at a
Switchboard form for the user to navigate through and close the Word
program.
Best would be to have it reopen the form that it came from in the
database as there is a command button in Access which opens this
report. Have no idea how to do this but the code above is my start.




  #5   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?U2xvdyBMZWFybmVy?=,

I have a Word document which I wish to have close and open an Access Database
form.

Are you still looking for help with this, or have you found the answer in the
meantime?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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  
Slow Learner
 
Posts: n/a
Default

Still searching.
I had a response in Word Programming that has me really confused now. I
should think this is a simple procedure but for some reason I do not seem to
be getting my thooughts across.
I am not trying to open or close any other product but Microsoft and I am
using the command button feature in Word.
I do not understand what this function is in Word but in Access it can be
programmed in VB to open anything in that program and-or open Word and then
open a document in Word.
Now once I have the document open I want to be able to place a command
button labeled "Back to Choices" on the word document which takes the viewer
back to the Access database form containing other command buttons opening
other Word and Access choices.
Would appreciate some further insight if you can. Thanks

"Cindy M -WordMVP-" wrote:

Hi ?B?U2xvdyBMZWFybmVy?=,

I have a Word document which I wish to have close and open an Access Database
form.

Are you still looking for help with this, or have you found the answer in the
meantime?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)


  #7   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?U2xvdyBMZWFybmVy?=,

I do not understand what this function is in Word but in Access it can be
programmed in VB to open anything in that program and-or open Word and then
open a document in Word.
Now once I have the document open I want to be able to place a command
button labeled "Back to Choices" on the word document which takes the viewer
back to the Access database form containing other command buttons opening
other Word and Access choices.

This last part is the problem, I should think. Word doesn't usually have
buttons on its documents, so there's no slick way to attach code to something
like that. It involves using the VB-Extensibility library for Office to add
code lines to a code module. And, most likely, you'd need to first create the
code module in the document. Furthermore, in doing so, you mark the document as
having macro code in it, which will activate macro security the next time the
user tries to open it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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  
Slow Learner
 
Posts: n/a
Default

So in other words not a good idea? Thoughts are that it would be useful in a
workgroup environment using a database application as an intranet. In this
way a person could open the Word document and when finished exit through the
document to intranet neighbourhood again. Or would it be easier to have some
other means of closing out the word document and program?

"Cindy M -WordMVP-" wrote:

Hi ?B?U2xvdyBMZWFybmVy?=,

I do not understand what this function is in Word but in Access it can be
programmed in VB to open anything in that program and-or open Word and then
open a document in Word.
Now once I have the document open I want to be able to place a command
button labeled "Back to Choices" on the word document which takes the viewer
back to the Access database form containing other command buttons opening
other Word and Access choices.

This last part is the problem, I should think. Word doesn't usually have
buttons on its documents, so there's no slick way to attach code to something
like that. It involves using the VB-Extensibility library for Office to add
code lines to a code module. And, most likely, you'd need to first create the
code module in the document. Furthermore, in doing so, you mark the document as
having macro code in it, which will activate macro security the next time the
user tries to open it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)


  #9   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?U2xvdyBMZWFybmVy?=,

So in other words not a good idea? Thoughts are that it would be useful in a
workgroup environment using a database application as an intranet. In this
way a person could open the Word document and when finished exit through the
document to intranet neighbourhood again. Or would it be easier to have some
other means of closing out the word document and program?

Hmmm. For this scenario, I could imagine something along these lines:

1. From the "other application" you click a button that automates Word and opens
the document.

2. At the same time, it also loads an Addin (could be COM or template). This
addin basically adds a toolbar, toolbar button and/or menu command (you choose)
bound to VBA code that will do what you envision.

The differences to what you postulated befo

- You don't need to create code "on the fly"
- The addin can be digitally signed or placed in a trusted location
- The code won't be inside the document (so no worries about it triggering
macro security)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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  
Slow Learner
 
Posts: n/a
Default

I would like to try this out.
I have the button in the 'other' application (in this case a .mdb file)
which opens MSWord.
Next would be the addin or COM and I would like to see an icon on the
standard toolbar that everyone would have open which when selected takes the
person back.

So now my question, how do you do this? I have not done any addin or COM
things as yet.
Thanks

"Cindy M -WordMVP-" wrote:

Hi ?B?U2xvdyBMZWFybmVy?=,

So in other words not a good idea? Thoughts are that it would be useful in a
workgroup environment using a database application as an intranet. In this
way a person could open the Word document and when finished exit through the
document to intranet neighbourhood again. Or would it be easier to have some
other means of closing out the word document and program?

Hmmm. For this scenario, I could imagine something along these lines:

1. From the "other application" you click a button that automates Word and opens
the document.

2. At the same time, it also loads an Addin (could be COM or template). This
addin basically adds a toolbar, toolbar button and/or menu command (you choose)
bound to VBA code that will do what you envision.

The differences to what you postulated befo

- You don't need to create code "on the fly"
- The addin can be digitally signed or placed in a trusted location
- The code won't be inside the document (so no worries about it triggering
macro security)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?U2xvdyBMZWFybmVy?=,

Sorry about the late response. I was away for the holidays and am still playing
catchup...

I would like to try this out.
I have the button in the 'other' application (in this case a .mdb file)
which opens MSWord.
Next would be the addin or COM and I would like to see an icon on the
standard toolbar that everyone would have open which when selected takes the
person back.

Easiest would be to create a Word template, saved to a specific location, that
contains the toolbar+macro code to go back.

When your code in Access starts up Word (I'm assuming you're using GetObject,
CreateObject, or the New keyword to do this), then you can load the Addin like
this:

Dim addin as Word.Addin

Set addin = WordApp.Addins.Add "C:\path\filename.dot", False
WordApp.CustomizationContext = Templates(addin.Path & "\" & addin.Name)
WordApp.CommandBars("Name of toolbar").Visible = True

Assuming, when the user should return to the Access database, that the document and
Word application should be closed, first call the Access stuff and bring it to the
front. Then

WordApp.Quit SaveChanges:=WordApp.wdDoNotSaveChanges

1. From the "other application" you click a button that automates Word and opens
the document.

2. At the same time, it also loads an Addin (could be COM or template). This
addin basically adds a toolbar, toolbar button and/or menu command (you choose)
bound to VBA code that will do what you envision.



Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)

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 2003 default view for opening .rtf attachments. rlloyd Microsoft Word Help 1 November 25th 04 02:53 PM
Acrobat writer 5.0 Compatibility with word 2003 Norman Marshall Microsoft Word Help 1 November 25th 04 11:12 AM
Template link prevents word doc from opening Scrich Microsoft Word Help 2 November 24th 04 03:40 PM
Word 97: Error message on opening document Ray Microsoft Word Help 1 November 23rd 04 11:19 PM
Word 2003 tried to access internet when started? Brian Microsoft Word Help 2 November 23rd 04 09:46 PM


All times are GMT +1. The time now is 09:45 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"