Help with Syntax

jwindon

Registered User.
Local time
Today, 10:00
Joined
Aug 12, 2001
Messages
531
I've tried to find an example without success. Could someone help me out here?

My Code is written this way right now, but I get errors no matter what I try.

Docmd.RunCommand acCmdOpenHyperlink "C:\My Documents\Shift End Report.xls"
 
http://home.clara.net/tkwickenden/coding.htm

It looks like you have to set the hyperlink value of some control first.
Your alternative is to use Appactivate or Shell to run the spreadsheet directly from code rather than set a hyperlink on a form, then follow it using the acCmdOpenHyperlink or Hyperlink.Follow
 
That was an example only. I want to set Code on the OnClick event of a command button that will open a mail merge Word doc. Ideally, I want to merge the doc automatically, but I'm not to that point yet. The Code works if I put a hyperlink on the form and enter OnClick events for the label. The Code runs before the hyperlink is activated...so my solution was found. However, while I was playing around with it, I came accross this action method and it has me perplexed as to the correct syntax. Still wanting to know why I get "compile errors" and "expected end of statement" when I try different things like () and "".

Any help?
 
Hi,
I'm not really sure, but I remember having a problem when opening a file if the filename contains white spaces. Try changing the filename like "Shift_End_Report.xls".
 
Have you tried DDE instead ? You will have alot more control and will be more dynamic than a fixed link i.e. You can let the user select a document or datasource from a lookup and then merge using the user defined variables ... give it a go ... else just try doing the mail merge in Access using a report , alot simpler
 
Thanks for all the suggestions. As for DDE, no I haven't tried it. I don't really know what exactly that is. I set up a Word Mail Merge Doc that draws its data from Access. THAT is the file I want to open with my Code. As for the whitespaces thing, I will try another file that doesn't have any and see what happens.
 

Users who are viewing this thread

Back
Top Bottom