Inserting Help Documents into an Access Application
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Inserting Help Documents into an Access Application
I have several MSWord documents containing help information for my inventory application. What is the best way to integrate them into the Access application?
Specifically, I have a separate Word document for each form and they are of varying lengths. I would like the user to be able to click on a button on each form and have the appropriate help document displayed.
TIA
Specifically, I have a separate Word document for each form and they are of varying lengths. I would like the user to be able to click on a button on each form and have the appropriate help document displayed.
TIA
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
You could store the Word documents in the same folder as the database, and set the Hyperlink Address property of the command button to the name of the appropriate document. Clicking the button will open the document in Word.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Re: Inserting Help Documents into an Access Application
Hi Hans,
Thank you for the answer. This works, BUT, now I get a "Microsoft Access Security Notice" that states that the location may be unsafe. (Access 2007 in 2002-2003 Format, Windows 7) The Word File is in the same folder with the mdb. I tried a pdf file and get the same inane message. I see that there is a registry change that might correct it, but I don't want to mess with registries. This will be installed on a machine other than my own when completed.
Attached is screen shot of offending message.
TIA
Thank you for the answer. This works, BUT, now I get a "Microsoft Access Security Notice" that states that the location may be unsafe. (Access 2007 in 2002-2003 Format, Windows 7) The Word File is in the same folder with the mdb. I tried a pdf file and get the same inane message. I see that there is a registry change that might correct it, but I don't want to mess with registries. This will be installed on a machine other than my own when completed.
Attached is screen shot of offending message.
TIA
You do not have the required permissions to view the files attached to this post.
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
Here is a method to get around it.
Create a new module in the Visual Basic Editor (Insert | Module)
Copy the following code into the module:
Clear the Hyperlink Address property of the button.
Create the following On Click event procedure for the help button:
where:
- cmdHelp should be replaced by the name of the help button.
- Helpfile.doc should be replaced by the name of the help file.
- Note: if the help file is in the same folder as the database, you don't have to specify the path.
- If you'd like the help file to be opened in a maximized window, change SW_SHOWNORMAL to SW_SHOWMAXIMIZED.
Create a new module in the Visual Basic Editor (Insert | Module)
Copy the following code into the module:
Code: Select all
Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMAXIMIZED = 3
Create the following On Click event procedure for the help button:
Code: Select all
Private Sub cmdHelp_Click()
ShellExecute Application.hWndAccessApp, "Open", _
"Helpfile.doc", 0&, 0&, SW_SHOWNORMAL
End Sub
- cmdHelp should be replaced by the name of the help button.
- Helpfile.doc should be replaced by the name of the help file.
- Note: if the help file is in the same folder as the database, you don't have to specify the path.
- If you'd like the help file to be opened in a maximized window, change SW_SHOWNORMAL to SW_SHOWMAXIMIZED.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Re: Inserting Help Documents into an Access Application
Hi Hans,
I copied and pasted the module code into a module called "Module1"
I copied and pasted the code into the module _click. I set a trap and tried to execute with a single left click.
The trap showed and I F8'd and nothing happened. I removed the trap, got all the way out of access and then came back in and tried it again. Nothing happened.
I must be missing a library someplace in my references, but nothing is showing up .
Please help.
TIA
I copied and pasted the module code into a module called "Module1"
I copied and pasted the code into the module _click. I set a trap and tried to execute with a single left click.
The trap showed and I F8'd and nothing happened. I removed the trap, got all the way out of access and then came back in and tried it again. Nothing happened.
I must be missing a library someplace in my references, but nothing is showing up .
Please help.
TIA
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
No non-standard references are needed for this code.
You should create an event procedure for the On Click event of the command button; it will automatically be in the form's code module, not in a module named _click.
You should create an event procedure for the On Click event of the command button; it will automatically be in the form's code module, not in a module named _click.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Re: Inserting Help Documents into an Access Application
Hans,
I hate to be a pest but I don't get this code to work.
Private Sub cmdHelp_Click()
ShellExecute Application.hWndAccessApp, "Open", _
"helpfile.doc", 0&, 0&, SW_SHOWNORMAL
End Sub
is the (event) code that the button on the screen activates.
The document (helpfile.doc) is in the same folder as the mbd files. (I have the front end and back end split into two MDB Files):
When I click on the button, nothing happens. If I trap the code, I am executing the call as above.
I can copy and paste with the best of them, but Idon't understand this code and as such can't trouble shoot anything.
TIA
I hate to be a pest but I don't get this code to work.
Private Sub cmdHelp_Click()
ShellExecute Application.hWndAccessApp, "Open", _
"helpfile.doc", 0&, 0&, SW_SHOWNORMAL
End Sub
is the (event) code that the button on the screen activates.
The document (helpfile.doc) is in the same folder as the mbd files. (I have the front end and back end split into two MDB Files):
When I click on the button, nothing happens. If I trap the code, I am executing the call as above.
I can copy and paste with the best of them, but Idon't understand this code and as such can't trouble shoot anything.
TIA
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Inserting Help Documents into an Access Application
I'm just taking a chance here??? but I notice that Hans's Public Function:
Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
has "ShellExecuteA"
and the Private Sub has "ShellExecute".
Might this be the problem that the code is not working???
Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
has "ShellExecuteA"
and the Private Sub has "ShellExecute".
Might this be the problem that the code is not working???
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
Please don't confuse the issue, Rudi.Rudi wrote:I'm just taking a chance here???
ShellExecuteA is the name of the Windows API function in Shell32.dll. This function is declared as ShellExecute, and that is the name to be used in the code.
I have posted this code many times in the Windows Secrets Lounge, and I tested it again before posting it here. It worked correctly.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
Could you do the following:PaulW wrote:Hans,
I hate to be a pest but I don't get this code to work.
- Create a copy of the database.
- Remove all content that is not relevant to the problem.
- Remove all sensitive information.
- Compact and repair the database.
- Create a zip file with the database. It should be smaller than 256 KB in size.
- Attach the zip file to a reply.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 331
- Joined: 11 Feb 2010, 03:55
- Location: Land O Lakes, FL
Re: Inserting Help Documents into an Access Application
Hans,
I tried the function as you wrote it and nothing happened. No error, it just didn't do anything. I then made this change and it worked fine:
Private Sub cmdHelp_Click()
ShellExecute Application.hWndAccessApp, "Open", _
CurrentProject.Path & "\Helpfile.doc", 0&, 0&, SW_SHOWNORMAL
End Sub
Apparently the "current" windows directory may not always be the directory the database is in, depending on how you started the database.
I tried the function as you wrote it and nothing happened. No error, it just didn't do anything. I then made this change and it worked fine:
Private Sub cmdHelp_Click()
ShellExecute Application.hWndAccessApp, "Open", _
CurrentProject.Path & "\Helpfile.doc", 0&, 0&, SW_SHOWNORMAL
End Sub
Apparently the "current" windows directory may not always be the directory the database is in, depending on how you started the database.
Mark Liquorman
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.
-
- Administrator
- Posts: 78439
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Help Documents into an Access Application
Thanks, Mark - I hope that helps!
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Re: Inserting Help Documents into an Access Application
Mark, Hans, Rudi -
You guys are awsome! Mark's suggestion works!!!!!
I don't know where you got all this expertise in these languages, but I am very appreciative.
Thanks Again ,
You guys are awsome! Mark's suggestion works!!!!!
I don't know where you got all this expertise in these languages, but I am very appreciative.
Thanks Again ,
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Inserting Help Documents into an Access Application
I guess my awesome-ness must be in my good looks... as i don't think it came from my reply
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 3StarLounger
- Posts: 331
- Joined: 11 Feb 2010, 03:55
- Location: Land O Lakes, FL
Re: Inserting Help Documents into an Access Application
Basically by hanging around places like this, trying to answer questions that people ask. And when we don't know the answer off-hand, we try some things until we've got it figured out.PaulW wrote:Mark, Hans, Rudi -
You guys are awsome! Mark's suggestion works!!!!!
I don't know where you got all this expertise in these languages, but I am very appreciative.
Thanks Again ,
Mark Liquorman
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.