By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Auto Hyperlink

P: 58
I would like to use the values in certain fields to create a link to a file.

For example:

Link to Inspection: LCase(Left([Company Name],3)) & "." & [Client] & "." & [Inspection Type] & "." & [Year] & "." & [Month] & "." & [Reference Number]

hal.46.chainfall.2004.01.001964 is the file name

the link would be http://www.website/customername/insp...s/filename.pdf.

I need to make sure the year is 4 digits and the month is two digits.

Can this be done automatically? If so, how?

Thank you,
ang
Jan 6 '07 #1
Share this Question
Share on Google+
6 Replies


pks00
Expert 100+
P: 280
>>I need to make sure the year is 4 digits and the month is two digits.

Where is year and month set? are they form fields? does the month field hold a number or text?
If year is 2 digits, then does it refer to current year?, u could just do

format(now(),"yyyy")

to return a 4 digit year

and for month, u can do

format(now(),"mm")

or if form field, add leading zeros

format([month],"00")
Jan 7 '07 #2

NeoPa
Expert Mod 15k+
P: 31,615
It appears that [Year] & [Month] are actually fields within your table.
You'll notice how that's already caused confusion. It is recommended that you avoid using such names to avoid confusion.
However, as asked, the question wants these two fields showing always 4 & 2 digits respectively.
The Format() function (Format$() is not recommended by M$ for new code) will do this for you :
Expand|Select|Wrap|Line Numbers
  1. Link to Inspection: LCase(Left([Company Name],3)) & "." & [Client] & "." & [Inspection Type] & "." & Format([Year],"0000") & "." & Format([Month],"00") & "." & [Reference Number]
Jan 8 '07 #3

P: 58
It appears that [Year] & [Month] are actually fields within your table.
You'll notice how that's already caused confusion. It is recommended that you avoid using such names to avoid confusion.
However, as asked, the question wants these two fields showing always 4 & 2 digits respectively.
The Format() function (Format$() is not recommended by M$ for new code) will do this for you :
Expand|Select|Wrap|Line Numbers
  1. Link to Inspection: LCase(Left([Company Name],3)) & "." & [Client] & "." & [Inspection Type] & "." & Format([Year],"0000") & "." & Format([Month],"00") & "." & [Reference Number]

That worked great and was exactly what I needed. Thank you. Now there's another issue created with this field I was hoping you could help with.

Each line item in my table has the following fields: (among others)

Company Name
Client (number)
Inspection Type
Reference Number
Link to inspection

I need to create a hyperlink to the .pdf of the actual inspection for that line item. The name of the file is dependent upon the contents of the above fields.

=LCase(Left([Company Name],3)) & "." & [Client] & "." & [Inspection Type] & "." & Format([Year],"0000") & "." & Format([Month],"00") & "." & [Reference Number].

i.e. hal.46.annual.2006.01.001234 (text to appear)

http://www.somewebpage.com/clientsubfolder/hal.46.annual.2006.01.001234.pdf (actual link)

When I use the formula to create the hyperlink, the format of the hyperlink goes away and can no longer be clicked on to access the file.

Any suggestions?
Jan 10 '07 #4

NeoPa
Expert Mod 15k+
P: 31,615
I believe there's some sort of Hyperlink property in the control.
I'm not sure - never use that myself. Sorry.
Jan 11 '07 #5

P: 36
If you want to open the file using a command button, you can reference the link to the command button property. e.g.

Expand|Select|Wrap|Line Numbers
  1. Me.cmdOpen.HyperlinkAddress = "http://www.google.com/"
HTH,
George



I believe there's some sort of Hyperlink property in the control.
I'm not sure - never use that myself. Sorry.
Jan 11 '07 #6

NeoPa
Expert Mod 15k+
P: 31,615
HyperlinkAddress Property

You can use the HyperlinkAddress property to specify or determine the path to an object, document, Web page or other destination for a hyperlink associated with a command button, image control, or label control.

That means you will have to set up one of those types of control for it.
Jan 11 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.