Create query that shows file names and paths

A

Apples76

i would like to creatre a query that displays the names of files and the full
path. to allow the path to be stored as a hyperlink on a form.

could somebody please show me what is required to do it.

Many thanks
 
S

scubadiver

As far as putting file paths into a query I don't want your set up is, but I
can help you with part 2 at least.

Put the following in the "on click" event of the button. The second line
contains the query column name and then the name of the query itself.


Dim varURL As Variant

varURL = DLookup("[File]", "Query2")

If IsNull(varURL) Then
MsgBox "Sorry, this document does not exist!", vbOKOnly + vbInformation
Else
Application.FollowHyperlink varURL
End If
 
S

scubadiver

PS. If you use your query as the source of your form, use a continuous form
and put the button on the record row so you have a button for each file path.
That should work (hopefully).
 
S

scubadiver

PPS. In the query you can concatenate fields however you like:

[field1] & " " & [field2] & "\" & [field3]

will put a space and a backslash between the three fields

or

[field1] & [field2] & [field3]

to have no spaces between fields.

Hope this helps
 
A

Apples76

Thanks Scuba,

but i need some example code to list the files on a networked drive in my
case this is "Y:\Final Account Details\Final
Accounts_OLO\Schedules\Pending\Company name"
 
Top