shortcut to Word file in Access

  • Thread starter Thread starter Sara
  • Start date Start date
S

Sara

I would like to include a shortcut to a Word file in Access. Is there a way?
I tried pasting a shortcut in a memo field, but it wouldn't do that. Thanks!
 
Sara said:
I would like to include a shortcut to a Word file in Access. Is there a
way?
I tried pasting a shortcut in a memo field, but it wouldn't do that.
Thanks!

Place a buttion on a form.

The code behind the form can be:

Application.FollowHyperLink "full pathname + doc name goes here"

Note that the path name you place above could be the name of a field or
control, not just a hard coded path name in as my above example shows.

When the user clicks of a button, the document or path name associated with
the above will be opened (this means you can do this for excel, or even PDF
files).
 
It took me a few minutes to figure out some stuff about buttons and codes,
but it worked! Thanks!
 
Although it works, after testing it, I wasn't clear about what I was looking
for. I was looking for something that I could put in each record that would
take me to a different Word document for each record. I'm guessing that may
not be possible.
 
Sara said:
Although it works, after testing it, I wasn't clear about what I was
looking
for. I was looking for something that I could put in each record that
would
take me to a different Word document for each record. I'm guessing that
may
not be possible.

You can most certainly do the above, but always it's the issue of details
and how you plan to do this.

Do you have some particular field name that designates that the particular
word document you want to open? the can simply use that field name in place
of the string we talked about.

eg:

Application.FollowHyperlink me.MyWordDocField

If you had a field called "mywordDocfield", and inside of that field was a
full qualified path name to a word document, then the above code would
launch a different document for each record you're on.

It's not clear if you are trying to merge data from the current form into a
particular word document, or you just have a particular different word
document associated with a particular record. (both of these choices are
possible, and are often done in access).
 
I created a text field and named it "mywordDocfield" I entered
"Application.FollowHyperlink me.MyWordDocField" for the code for the field.
When I try to enter data in the field, it gives me "Run-time error '94':
Invalid use of Null"
 
Sara said:
I created a text field and named it "mywordDocfield" I entered
"Application.FollowHyperlink me.MyWordDocField" for the code for the
field.
When I try to enter data in the field, it gives me "Run-time error '94':
Invalid use of Null"

You don't use that code as an expression.

You simply place that text box on your form. You then need to place a button
beside the text box, and behind that button, you place the sample code I
gave you.
 
I am apparently just missing something. If it makes any difference, I am
using Access 2007 and trying to bring up Word 97-2003 documents. I created a
text box. I went into properties for the text box and named it
"mywordDocfield" (without the quotation marks). I created a button and for
“on click†I chose “code builder†and pasted “Application.FollowHyperlink
me.MyWordDocField†between “Private Sub Docket_Click()†and “End sub†I then
put an entire document name, including path, in the data box for the text box
field. I get the following error: “Run-time error ‘438’: Object doesn’t
support this property or method.â€
 
Sara said:
I am apparently just missing something. If it makes any difference, I am
using Access 2007 and trying to bring up Word 97-2003 documents. I
created a
text box. I went into properties for the text box and named it
"mywordDocfield" (without the quotation marks).

you of course can give in a text box any name you want.
I created a button and for
"on click" I chose "code builder" and pasted "Application.FollowHyperlink
me.MyWordDocField" between "Private Sub Docket_Click()" and "End sub"

The above code sample you're giving me tells me that the button you created
was called Docket? I'm not sure if that looks right at all.

I would place a button on the form, don't use the wizard to place this
button on the form.

Now, view the property sheet for this button.

Now click on the event tab of the property sheet.

now click on click of the property sheet

at this point I'm to the right of the property sheet you'll see a little
ellipse thing appear it looks like [...]

click on this ellipse, and you should get 3 options, choose the code option.


Type in that one line of code.

The sequence of steps that you have to take to insert a button, and place
code behind it is outlined here:

http://www.members.shaw.ca/AlbertKallal/wordmerge/Details.htm
(Ignore the first part about setting references, there is a nice sequence of
steps that you have to take to place a button on your form and code behind
it )

If you're more comfortable, I suppose you could also use a macro in this
case, but the it's really only one line of code you have to type in
anyway....

Furthermore, it's not clear if you want the path + link to be saved in that
record. remember, simply placing a text box on a form does not mean what
you typed into that text box will be saved in the table behind (for every
text box you place on a form, you must specify the underlying field from the
table if you want the information typed into this box to be saved). it turns
out that most cases the name of the text box is the same as the underlying
field, but it doesn't have to be.

If you having trouble with the above, then consider creating a hyperlink
field in your table in design mode. You then simply drop that field onto
your form. The result will be a field with the equivalent behavior of the
above, and you'll not have to write code. (the field will actually show as
an underlined hyperlink type field).

Try giving both of the suggestions a try and see which one you like better,
or works for you better...
 
Hooray, it worked! Thank you for your patience and persistence.

Albert D. Kallal said:
Sara said:
I am apparently just missing something. If it makes any difference, I am
using Access 2007 and trying to bring up Word 97-2003 documents. I
created a
text box. I went into properties for the text box and named it
"mywordDocfield" (without the quotation marks).

you of course can give in a text box any name you want.
I created a button and for
"on click" I chose "code builder" and pasted "Application.FollowHyperlink
me.MyWordDocField" between "Private Sub Docket_Click()" and "End sub"

The above code sample you're giving me tells me that the button you created
was called Docket? I'm not sure if that looks right at all.

I would place a button on the form, don't use the wizard to place this
button on the form.

Now, view the property sheet for this button.

Now click on the event tab of the property sheet.

now click on click of the property sheet

at this point I'm to the right of the property sheet you'll see a little
ellipse thing appear it looks like [...]

click on this ellipse, and you should get 3 options, choose the code option.


Type in that one line of code.

The sequence of steps that you have to take to insert a button, and place
code behind it is outlined here:

http://www.members.shaw.ca/AlbertKallal/wordmerge/Details.htm
(Ignore the first part about setting references, there is a nice sequence of
steps that you have to take to place a button on your form and code behind
it )

If you're more comfortable, I suppose you could also use a macro in this
case, but the it's really only one line of code you have to type in
anyway....

Furthermore, it's not clear if you want the path + link to be saved in that
record. remember, simply placing a text box on a form does not mean what
you typed into that text box will be saved in the table behind (for every
text box you place on a form, you must specify the underlying field from the
table if you want the information typed into this box to be saved). it turns
out that most cases the name of the text box is the same as the underlying
field, but it doesn't have to be.

If you having trouble with the above, then consider creating a hyperlink
field in your table in design mode. You then simply drop that field onto
your form. The result will be a field with the equivalent behavior of the
above, and you'll not have to write code. (the field will actually show as
an underlined hyperlink type field).

Try giving both of the suggestions a try and see which one you like better,
or works for you better...
 

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

Back
Top