Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Openning a file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,

I'm a beginner... just trying out Access

Is there anyway to setup a button in an Access Database so that it will open a specific file when it's clicked.

Ex: The database contains all products of my air conditioning company. Each product has it's own PDF file containing description, specs, price, etc... I want to be able to click a button so that the PDF file will launch when I search for that product.

I know that you could associate a button so that it will launch an application but I don't know how to associate a file...

Any help is appreciated :)

Thanks in advance
 
You could try creating a Macro command 'RunApp' with the path and file name of the PDF document only (eg c:\mydocs\mydoc.pdf)

Acrobat or Acrobat reader usually automatically associates to pdf extensions and so load Acrobat (or Acrobat Reader) with the requested .pdf file

The Macro would have to be flexible to be able to take a variable parameter and so I would recommend writing a 'On click' event for the button in code in association with a hidden (or displayed) field containing the path and filename. Somthing like;

private Sub MyButton_Click()

dim MyVal as variant
dim MyDoc as String

MyString=Chr(34) & me.tbDocName.Value & Chr(34)
MyVal=Shell(MyString, 1)

end sub

Cheers

Andy
 
How would I accomplish this?

I created the Macro that would open Acrobat. I have the button set so that when it's clicked it will run the macro.

My question is Where do I put the code in?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top