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
LVL 1
taborrgAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.