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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically Linking files

Status
Not open for further replies.

Bob500

Technical User
Aug 8, 2003
65
0
0
EU
Hi, what code would I put on a button on a form that would allow a user to specify the location of a file on a harddrive and then assign that file to another button that has this code on it to open the specified file:

Private Sub Command273_Click()
On Error GoTo Err_Command1_Click

Dim stAppName As String
Dim fileName As String

'the location of the file set to the button below
fileName = "this location to be set"
'the location of the explorer.exe
stAppName = "C:\winnt\explorer.exe " & tiffName
Call Shell(stAppName, 1)

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub

Does that make sense?

Ps. It would also be great to be able to input a name for the newly specified link on a textbox

many thanks.
 
Hi Bob500,

You could take a look at Common Dialog Access97 and 2000 which can be downloaded from
From the Switchboard select: "Print or Open Selected File"

This application uses the Common Dialog Control and might help do what you want. See thread705-457897 for further info.

Bill
 
You can add a common dialog box to the form and depending on the properties you set it allows you to display the standard Windows Open File display. I can't remember off the top of my head but this link might be of some help.


PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Thank you both for your replies.

Billpower,

I am trying to use the hyperlink form to create a list of files, but I keep getting a error about glInitDir. Any ideas why?

Also since you seem to know what you are doing :) I am trying to reference a field in an unlinked table from a form, how would I specify the path, the table is called tranche and the field tranches.

I have:

tranche![tranches]

but this does not work

Many many thanks
 
Hi, I figured out the first query but still stuck on that path :(
 
You could make the Recordsource of your Form (obviously edit it to the name and location of your DB):

SELECT tranches.tranche
FROM tranches IN 'C:\Folder\DBName.mdb';

If I've misunderstood what you are trying to, explain in more detail.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top