• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

Open an Access form from a link in a Word document.

Hi,

Is there a way to open an Access form from a link in a Word document?  The Access database would already be opened.

The next thing would be to reference a field in the Word document - similar to using JustOpenedForm.txtField = WordDocument.txtField.

Thanks
0
taborrg
Asked:
taborrg
  • 4
  • 4
1 Solution
 
ErezMorCommented:
to open a form in a access mdb from outside (aka automation) you need to create a database object, then use it to reference and open the form with arguments sent (that's your data from word)

for example: (you need to add reference to Microsoft Access in your word vba project)

Dim ac As New Access.Application
ac.OpenCurrentDatabase ("c:\mydb.mdb")
ac.DoCmd.OpenForm "myForm", , , , , , "myDataFromWord"

then use "Me.OpenArgs..." to retreive the sent argument from word inside the access form's Open event (or aby other event you want)
0
 
taborrgAuthor Commented:
Hi ErezMor,

This looks promising.  Could you tell me how I would go about creating this in a Word Document?

Thanks
0
 
ErezMorCommented:
one way is to create ("record") a macro in word (you can also attach a keyboard combination that will run the macro), add some actions (whatever, you only want it so you'll have something) - you need the "developer" ribbon for that.
then use the code i suggested inside this macro (instead of the automatically created code) - you open the vba window by pressing alt-f11 in word.
remember to add the reference (in vba window, there is "references" menu at the top)
remember that this method will work only if your client allows macros to run in his office environment
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ErezMorCommented:
i now noticed you want a "link" in the document. i dont think this can be done, you can add a command button, (or a shortcut key, as i suggested)
0
 
taborrgAuthor Commented:
The scenario is that I am creating an application to help in doing research.

I have an Access database with a table of websites, including citation information.

I would like to copy and paste lines of text from a website into a Word document, and include a link back to the Access record of that website.  The idea is that days or weeks down the road, I could click on the Word document link and bring up the Access database record for that website,

So I find a website and highlight some text, click on an Access button and it copies the text to a Word document along with information needed to reload the website.

Thanks.
 
0
 
ErezMorCommented:
unless i missed something, what do you need the access for?
you can add hyperlinks to word documents with no coding at all, so that if clicked from within the document, it will open a browser and surf to that link
what is the added value of saving the link in an access record?
0
 
taborrgAuthor Commented:
I'm not looking for a way to store website links.

I will be copying much information from documents on websites to a word document - standard procedure in research.  That information will also be contained in an Access database for data mining purposes.

So when I'm looking over the Word document, days or weeks or even months later after doing a hundred or so such copy and pastes and editing them, I can use a link in the Word document to locate the database record that has the original information.

Thanks

0
 
taborrgAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now