RE: How to open Microsoft Word documents from a Microsoft Access F



Gary,

If the file name is in a textbox on your form, you can first define a string
type variable and then assign the path and file name to the string variable
like this:

dim strFulPathAndName as string

strFulPathAndName = "C:\Temp\" & me.NameOfYourTextbox

In the line above, you would replace the "C:\Temp\" with the actual path to
the folder where the files are being stored.

Then you can use the string type variable that will now hold the complete
path and the file name in your code to open the file.
--
HTH

Mr B


"Gary B" wrote:

Thanks.

Yes the file name is in a field on the Form and the files are being saved to
a specific folder.

Can you let me know the best way to concatenate the path and the file name
together to get the entire path.

Thanks again
G

"Mr B" wrote:

I may not be understanding what you are asking, but to try to answer your
question:

If you want to open any file, you will have to know the entire path. That
path can be a default path (just a predefined folder) or it could be just any
folder.

From the way you describe how the document is being processed and saved, I'm
afraid you will have to know the folder and the filename that you want to
retrieve.

If I understand correctly, you will have the file name in a field on your
form. If this is true, then all you need is the folder and you could then
concatenate the path and the file name together to get the entire path.

Many times this type if thing is something that can be coordinated between
you and the persons who are actually saving the files. Just come up with a
specific folder where all relative files are to be stored. Then, if you have
the file name in your form, it is simple to check to be sure the file is
there and if so, open it.

--
HTH

Mr B


"Gary B" wrote:

If it was a Word Document would I still have enter the entire path?

I'm trying to get a user to access a document that is stored outwith access
& maintained elsewhere. Each Form will have a different number in the Sales
order number field.

I can create a Folder and point the user to that folder with the Command
button below. There may be 200+ documents in that folder. They could scroll
through that folder and find the file manually.

I was hoping to get the filename picked up from the field within the
original Form, which has the same name as the file in the Folder outwith
access.



"Mr B" wrote:

Gary B,

If you are wanting to open the "scanned documents" then you would not be
opening a Word document. You would actually be opening a graphic file of some
type, depending on what file type the scanned image is being saved as.

To open or show the graphic you would need to have the entire path,
including the file name, saved to a field and the use that to open the
graphic.

--
HTH

Mr B


"Gary B" wrote:

I have a Form (Sales Orders) which contains a Sales Order number field. The
number in this field is used as the Delivery Note number when an item is
Despatched to a Customer. E.g. Sales Order number = 123456, Delivery Note
Number = 123456

The Delivery Note is scanned and filed in the network when returned with the
Driver e.g. G:\Distribution\POD\123456.doc

I can open up a Word Doc using -> Application – Run MS Word Command Button
and input the file path but this only goes as far as the Folder e.g.
G:\Distribution\POD

I would like to be able to link to each unique scanned document from the
Sales Order number field in my form to the POD.

Thanks in anticipation


.



Relevant Pages

  • Re: VB6 and Windows Media Player
    ... within the My Music Folder. ... Private Declare Function ShellExecute Lib "shell32.dll" Alias ... "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal ... the folder Documents and Settings eg:- C:\Documents and Settings? ...
    (microsoft.public.vb.general.discussion)
  • Re: File Input Question
    ... To have a user select a folder, not a file, I use the below. ... pszDisplayName As String 'Address of a buffer to receive the display name of the folder ... Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long ... Private Declare Function GetWindowRect Lib "user32" ...
    (microsoft.public.excel.programming)
  • Re: Execute macro for all documents in the folder
    ... It is simple enough to batch process a single folder. ... Dim strFileName As String ... It seems as though the below macro from an earlier posting was put ...
    (microsoft.public.word.docmanagement)
  • Re: Execute macro for all documents in the folder
    ... It is simple enough to batch process a single folder. ... Dim strFileName As String ... It seems as though the below macro from an earlier posting was put ...
    (microsoft.public.word.docmanagement)
  • Re: Declare Sub Sleep Lib "kernel32.dll" ( ByVal dwMilliseconds As Lon
    ... Sub MovePrintedFile(ByVal sFileName As String) ... Dim sDestinationFolder As String ... you can use Windows API commands to create the folder. ... Private Type SHFILEOPSTRUCT ...
    (microsoft.public.word.vba.general)