Opening excel files from Access

D

Daniel Lees

I am doing a database system and i want to be able to click a button on a
menu and it will open a specific Excel file. The way my database works is you
enter a job number into a text box click ok and a menu with all the
departments is shown, when you click on a department all the info for that
job is shown. There is information on Excel spreadsheets that i want to show,
i wanted it so when you click a button on the menu it open the excel file for
that job number which will just be the job number.xls e.g 4562.xls but the
other problem is that all the files are contained in seperate folders again
the job number. So the path for a file would be ...\4562\4562.xls. Is is
possible to get it to open the folder with the same name as is in the text
box and open the excel file within it?

Cheers

Danny
 
O

Ofer

You can search the forum on open excel

One of the answer will be: use the FollowHyperlink Mehod in the
CommandButton_Click Event.

Check Access VB Help on FollowHyperlink.
==================================
For the second section when you specify the path of sheet to open create the
string with the text box

dim MyDocToOpen as string
MyDocToOpen="c:\MyLocation\" & me.TextBoxName & "\" & me.TextBoxName & ".xls"

and the open using the MyDocToOpen
 
Top