Hyper-link Problem (1 Viewer)

gico1972

Registered User.
Local time
Today, 21:39
Joined
Oct 19, 2008
Messages
25
Need some help with my DB.

I currently have a form which displays records. One of the field [Number] reflects a contract number for a document held on the office server.

I simply wanted the user to click on [Number] on the form and this hyper-links to the office server where the underlying .XLS document is located.

The Server location remains static in that all documents are saved there and the .xls file name always matches the [Number] field in the database.

Therefore contract number 123 on the database form will always open up 123.xls etc

Appreciate some help with this.

Regards
 

gico1972

Registered User.
Local time
Today, 21:39
Joined
Oct 19, 2008
Messages
25
I am not an expert in code so this may be a hurdle to high for me. Having said that if i understand correctly you are assuming that the file name remains 123.

So that i am clear, the field value represents the contract number which equals the external .xls file name.

We are storing several hundred contracts and the idea is that if the user clicks on a form. contract number 125 for example. The hyper-link will open file 125.xls and contract number 200 will hyper-link to the same server location but will open up 200.xls and so on.

Apologies for perhaps not being clear enough on my first post.

Thanjs
 

ghudson

Registered User.
Local time
Today, 16:39
Joined
Jun 8, 2002
Messages
6,195
If the contract number has the value = to the file name then you would reference the text box that has that value to build the path file name as a string.

Code:
Application.FollowHyperlink "\\Server\Partitiion\Directory\" & txtContractNumber & ".xls", , True
 

gico1972

Registered User.
Local time
Today, 21:39
Joined
Oct 19, 2008
Messages
25
Thanks for that but it is not happy with the coding for the &".xls" part.


Application.FollowHyperlink "\\londcfs1\Data\" & txtNumber& ".xls",, True

Am i doing something wrong?
 

Simon_MT

Registered User.
Local time
Today, 21:39
Joined
Feb 26, 2007
Messages
2,177
I think I have seen something similar so I had to do this:

Code:
    With CodeContextObject
        Dim FileLink As String
        FileLink = "[COLOR=Black]\\londcfs1\Data\" [/COLOR][COLOR=Black]& .[txtNumber] & ".xls" & ""
        Application.FollowHyperlink FileLink, , True
    End With
Simon

[/COLOR]
 

ghudson

Registered User.
Local time
Today, 16:39
Joined
Jun 8, 2002
Messages
6,195
Thanks for that but it is not happy with the coding for the &".xls" part.


Application.FollowHyperlink "\\londcfs1\Data\" & txtNumber& ".xls",, True

Am i doing something wrong?

Use the debugger and see what the completed string looks like. Add this line to your code before you call the hyperlink.


Code:
debug.print "\\londcfs1\Data\" & txtNumber & ".xls"

If you can copy and paste the value from the Immediate window into windows explorer then you are good to go. If not, make the adjustments to get your path\filename perfected.
 
Last edited:

Users who are viewing this thread

Top Bottom