Minggu, 30 Oktober 2011

Re: [MS_AccessPros] How do I open a file in WordPad from a command button

 

Giorgio, Here is the code you asked about:

Private Sub btnHelp_Click()
On Error GoTo Err_btnHelp_Click

Dim RetVal As Long
RetVal = Shell("Notepad.exe " _
& "C:\Documents and Settings\Owner\My Documents\Word Pad Help Files\Access Help for Mail Merge", 1)

Exit_btnHelp_Click:
Exit Sub

Err_btnHelp_Click:
MsgBox Err.Description
Resume Exit_btnHelp_Click

End Sub

***********************

This code worked on my XP machine, but for some reason it could not find the when I used it in Windows 2007; therefore, I created a table for all of my help files and placed the actual help text in a memo field. The table has three fields: HelpID; HelpSubject (text); HelpFile (memo). And I have a popup form display when the Help button is clicked.

this way makes more sense to me now that I've done it, because I always have my help files with me and don't have to worry about copying a folder each time I move to another computer. This is not as much of a deal after the application is completed, but while I am creating the forms and reports and their associated help files, keeping them in a table helps me keep it all together.

I hope this helps.

Have a great day,

David

--- In MS_Access_Professionals@yahoogroups.com, giorgio_rovelli <no_reply@...> wrote:
>
>
> Hi David,
>
> What is the code behind the help button?
>
> Giorgio
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "David Tolson"
> <drtolson@> wrote:
> >
> > J
> >
> >
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John
> Viescas
> > Sent: Thursday, October 20, 2011 6:22 AM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> >
> >
> >
> >
> > Very nice.
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Paris, France)
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of
> David
> > Tolson
> > Sent: Thursday, October 20, 2011 11:55 AM
> > To: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> > John, since Access 7 has the new RTF formatting, I've decided to
> create a
> > table with all of the help files in memo fields. I placed an unbound
> text
> > box on each form that has a help button and in the control source of
> each of
> > these unbound text boxes I made them equal to the HelpFileID for the
> help
> > screen I'd like to pull up, and when the help button is clicked, it
> brings
> > up the appropriate help screen in a popup. It actually works pretty
> good,
> > and I do not have to worry about remember to bring the WordPad help
> files
> > with me when I transport the Access application somewhere.
> >
> > Thanks for the assistance, and have a great day.
> >
> > David
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of John
> > Viescas
> > Sent: Thursday, October 20, 2011 2:35 AM
> > To: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> > David-
> >
> > Are you able to double-click that file in Windows Explorer? Maybe the
> file
> > is
> > actually corrupt. Or maybe you already have the file open somewhere.
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Paris, France)
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of
> David
> > Tolson
> > Sent: Wednesday, October 19, 2011 11:24 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> > Thanks John, When I try the first method you gave, I get "Cannot open
> the
> > specified file," and when I try the second method, I get the same
> error
> > that I've always been getting. As I am struggling to open a file from
> > WordPad, I am wondering of it would make sense to load all of my help
> files
> > into a table that has a memo field and open it as a popup form. I
> think I'll
> > try it.
> >
> > Thanks again,
> >
> > David
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of John
> > Viescas
> > Sent: Wednesday, October 19, 2011 4:29 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: RE: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> > David-
> >
> > If WordPad is your default program to open .rtf files, then do:
> >
> > Application.FollowHyperlink
> > "C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf"
> >
> > If you specifically want to open it in WordPad, and that's not the
> default
> > program, then do:
> >
> > RetVal = Shell("""C:\Program Files\Windows
> NT\Accessories\Wordpad.exe"" " &
> > """C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf""", 1)
> >
> > You can probably get away without surrounding the second argument in
> quotes
> > because there are no spaces. But you MUST do that with the first
> argument,
> > or
> > it will try to open "NT\Accessories\Wordpad.exe" with what it finds at
> > "C:\Program Files\Windows".
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Paris, France)
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > [mailto:MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of
> > djsdaddy531
> > Sent: Wednesday, October 19, 2011 10:01 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > <mailto:MS_Access_Professionals%40yahoogroups.com>
> > Subject: [MS_AccessPros] How do I open a file in WordPad from a
> command
> > button
> >
> > Great Day, I am creating helps files in WordPad. When I attempt to
> open the
> > file
> > with the command button, I get the following WordPad error:
> >
> > C:\Users\David\Documents\IndependedntAutoHelpRepairOrder.rtf
> > Cannot find this file
> > Please verify that the correct path and file name are given.
> >
> > This is the code that I use to try to open the file:
> >
> > Dim RetVal As String
> > RetVal = Shell("C:\Program Files\Windows NT\Accessories\Wordpad.exe "
> &
> > "C:\Users\David\Documents\IndependentAutoHelpRepairOrder.rtf", 1)
> >
> > I have been having difficulty locating the proper path name of the
> file, so
> > I
> > went to the windows explorer dialogue box and highlighted the file and
> held
> > down
> > the shift key while right clicking the mouse, and then I clicked "Copy
> as
> > Path".
> > I pasted the path directly to the code.
> >
> > I am using Access 2007 and saving the files in 2003 version, and I've
> got
> > Windows 7 and Office 7 if that helps.
> >
> > Thanks in advance,
> >
> > David
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> > [Non-text portions of this message have been removed]
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> > [Non-text portions of this message have been removed]
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar