Question

L

l_bax

I have a folder (d:\Purchase Orders) in which I scan and store all
documents (Purchse Order, Material Request, Vendor Quote, Vendor
Invoice, etc) related to a Purchase Order (d:\Purchase Orders). I have
this because I am required to store the documents after all signatures
have been obtained. All the individual documents are scanned into one
PDF file with the PO Number as the name of the file. I have an Access
2003 database that I utilize to track all the PO information (PO_No,
Date, Item, Cost, etc.). I use a form Add/Edit PO. What I would like
to do is to create a command button on the form that would take me to
D:\Purchase Orders. I could then open the individual PO file and view
or print the PO if I needed to. I've looked at using a Macro but so
far have been able to get it to work. Any suggestion would be
appreciated.

TIA

Larry
 
A

Arvin Meyer [MVP]

l_bax said:
I have a folder (d:\Purchase Orders) in which I scan and store all
documents (Purchse Order, Material Request, Vendor Quote, Vendor
Invoice, etc) related to a Purchase Order (d:\Purchase Orders). I have
this because I am required to store the documents after all signatures
have been obtained. All the individual documents are scanned into one
PDF file with the PO Number as the name of the file. I have an Access
2003 database that I utilize to track all the PO information (PO_No,
Date, Item, Cost, etc.). I use a form Add/Edit PO. What I would like
to do is to create a command button on the form that would take me to
D:\Purchase Orders. I could then open the individual PO file and view
or print the PO if I needed to. I've looked at using a Macro but so
far have been able to get it to work. Any suggestion would be
appreciated.

I'd use ShellExecute to open the PDF file. Since you know the location of
the file, and the file name, it should be easy to open it directly from
Access:

http://www.mvps.org/access/api/api0018.htm

After saving that code above into a standard module, you can simply use the
following line of code in the Event Procedure for a command button:

fHandleFile("D:\Purchase Orders\" & Me.txtPONumber & ".pdf",WIN_NORMAL)

Where txtPONumber is the name of your textbox which is showing the PO Number
for that PO.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
L

l_bax

fHandleFile("D:\Purchase Orders\" & Me.txtPONumber & ".pdf",WIN_NORMAL)

I copied the code example(api0018.htm) into a module that I named
SetShell. I then copied the above line of code into the OnClick
procedure that is on my form. I get and error ( = expected). So far I
haven't figured out what the equal is supposed to equal. can you help?

TIA

Larry
 
D

Douglas J. Steele

fHandleFile is a function. That means it expects to return a value. You
either have to assign that value to a variable (eg.

Dim varReturn As Variant

varReturn = fHandleFile("D:\Purchase Orders\" & Me.txtPONumber &
".pdf",WIN_NORMAL)

or else you need to use the Call statement:

Call fHandleFile("D:\Purchase Orders\" & Me.txtPONumber &
".pdf",WIN_NORMAL)

If you go with the first approach, varReturn should be -1 if there were no
problems, or else an error number and description if there were problems.
 
D

Dirk Goldgar

Douglas J. Steele said:
fHandleFile is a function. That means it expects to return a value.
You either have to assign that value to a variable (eg.

Dim varReturn As Variant

varReturn = fHandleFile("D:\Purchase Orders\" & Me.txtPONumber &
".pdf",WIN_NORMAL)

or else you need to use the Call statement:

Call fHandleFile("D:\Purchase Orders\" & Me.txtPONumber &
".pdf",WIN_NORMAL)

Or else just drop the parentheses:

fHandleFile "D:\Purchase Orders\" & Me.txtPONumber & ".pdf", WIN_NORMAL
 

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

Top