Display a field as a link in Access - ms-access

I am working on a access application where one of the field is a unique ID number. When I display this field I would like to display it as a URL for example http://www.abc.com/?q=
How I do format a field for display in Access ?

Display where? On a form? If it is in a TextBox on a form then this has the property (in Access 2010) Display as Hyperlink, and the possible value Always. So take the ID and concatenate the rest of the text:
strSome = "http://www.abc.com/?q=" & theID
It is also possible in code to manipulate the Hyperlink property of a TextBox (although I haven't tested this). That is, to create a Hyperlink instance, based on the text in my code-line, set its Address and Sub-Address, and Text to Display properties, then set the TextBox's Hyperlink property to this instance. But, as I say, I haven't had a chance to test this.

Related

Access Form - how do I only display fields and cell values if the cell has data?

Could someone please help me with configuring my access database? I would like to use a combo-box at the top of the form where the user selects from the available work forms (Column 1 in Table) and then it displays who is involved in the form. Currently it displays every field and to reduce to the information displayed I would like it to only display information if the cell has a value in it.
Am I using the wrong tool? Should I be using a Report instead? How's my table data, too much?
Many Thanks
My current form
My wanted result
The way I normally hide empty fields is to change the label for a field to a control and set the control source to the following:
=IIf([FieldName]<>'', "My label:", Null)
Then I set the CanShrink property on both the "label" and the field to Yes.
Finally I make sure the section it's in (typically the detail but you may have reason to use something other) also has CanShrink set to Yes.
When you stack the controls on top of each other in this manner you should get the result as you posted.
Note: this only works for reports or if you print the results of a form. If you do not intend to allow entry of data into the form it would be better served as a report.

Display hyperlinks to a webpage in each cell as a button in Access 2010

I have a table in Access 2010 called Table1. Column NCBI contains hyperlinks to webpages. I would like to display each hyperlink as a button in each cell and the caption for that button to be the field value from the same row one column to the left, the column Gene.
Does anyone know how to accomplish this?
First you must have the table containing the website information. In my example I have a table called Websites. In the table there is two fields: URL which contains the direct URL such as http://google.com and WEBSITE_NAME which is simply the name of the website "Google".
Create the form however you would like it to look using whatever Default View that you would like, however make sure that the Record Source is set to the table containing the website name's and URL's. In my test one I used Datasheet.
On that form make sure at least the WEBSITE_NAME field is showing on form in a textbox, in mine I called it txtWEBSITE_NAME. There is a property that belongs to the txtWEBSITE textbox called Display as Hyperlink set that to "Screen Only".
Then go to the events tab of the txtWEBSITE, go to the On Click event and click the three dots and add this code to the sub procedure:
Private Sub txtWEBSITE_Click()
If Nz(Me.URL, "") <> "" Then
Application.FollowHyperlink Me.URL, , True
End If
End Sub
The Me.URL basically just says to use the URL that corresponds to the Website that was clicked. The Nz() function basically just checks to make sure that there is actually a URL that belongs to the website that was clicked.
You can add in your own error handling or validation checks but this is the barebones system that you can use to do what you were looking for.

Hyperlink control in Access App

I've created a hyperlink control on a form page in an Access 2013 App hosted in SharePoint 2013, and want the text to display the same text ("Print Timesheet") while the actual link itself varies based on the value of a field in the record. This is so that I can link to a separate application using a query string with the individual record ID, which gets the data directly from the azure database and formats it in order to be printed out.
I've tried a macro expression to create the link address that runs "on current" and sets the value of the hyperlink, and also tried a computed column in the table to create the link which I pass to the hyperlink control value. I've set the "Default Display Text" on the hyperlink control to "Print Timesheet" in both cases.
The problem I have is that whichever way I try it, changing the value on the fly like this overrides the default display text of the hyperlink so that it displays the address itself rather than the text I want to display.
Is there any way round this?
Thanks,
Duncan
I am not sure if you got your answers. I was randomly looking on internet and found your query.
I thought the thread Troubles with Hyperlink control in Access Web App forms may have your answer.
LILizEidsness replied on August 21, 2014See post history
.....
If you have to build a url field dynamically, the basic syntax is
displaytext#url#
so, in my dynamic field....
=Concat("Click here#/relative/path/on/my/sharepointsite/allitems.aspx&ID=",[ID],"#")
....
You could use a label on the form to represent the link. Have the Label.Caption property set to "Print Timesheet" and use the On Current event to set the Label.HyperlinkAddress property to whatever the address from the recordsource is.

hyperlink doesn’t work in Access form

I have an Access form in which I am unsuccessful in formatting the record to be in hyperlink format.
The form is in datasheet-view format, which contains records with a link to a website. The form’s datasource is a select-query. The hyperlink is created with the following expression, which concantenates text and data, in order create a web link :
"#http://www.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_us&InquiryNumber1=" & [T].[tracking_number] & "&track.x=0&track.y=0#"
I tried setting the property-sheet format field to “hyperlink” , but it automatically changes to “hy"perli"n\k”, in both the query-design view, and form-design-view.
please advise what I need to do in order to have the form output the records in hyperlink format, so I can just click on the website link and it will open up in a web browser
thanks very much in advance,
Nathaniel, Access 2007
You can use the IsHyperlink property for the textbox (format tab) , once again, these are a nuisance to edit. If you create a form based on a table with a hyperlink field, the control created for the hyperlink field will be set up as a link.
More on IsHyperlink: http://msdn.microsoft.com/en-us/library/aa196153(office.11).aspx
Paste something like this into the textbox to see it working:
clickme#http://www.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_us&InquiryNumber1=123456&track.x=0&track.y=0#

Textbox in Reporting Services - show text or hyperlink

I have a report in SQL Server Reporting Services which should show
a text box with a static text for "normal" users
a text box with a hyperlink to open up a new details windows for "super" users
The user level is determined by a parameter being passed into the report.
How can I achieve this? I tried to create a textbox with a text span inside that has a hyperlink, and then just leave it blank for "normal" users, but that doesn't seem to work reliably.
Is there a trick or method to get this to work? I'm thinking I need to add some code to the report to check the user level and then either insert a static text, or a text with a label, into that target textbox. But how do I do that (not having any VB/VBA/VB.NET experience....)
Thanks!
Marc
To make the hyperlink, you should be able to use an expression like
=iif(Parameters!IsSuperUser.Value = True, "http://some link","#")
in the Action property of the textbox, if you set the Action to "Jump to URL".
To control the content of the textbox, use a similar expression in the Value property.
(This is true on SSRS 2005 - I don't have access to 2008)
Edit
Unfortunately, hyperlinks in SSRS aren't formatted in a way to make it clear that they're hyperlinks. The only way to achieve this would be to add similar conditional formatting expression to the Color and TextDecoration attributes to make the field appear in a different colour and underlined when it is a hyperlink.
I haven't got SSRS installed on the machine that i'm writing this on so i can't give you an exact guaranteed bug free answer, but this answer should set you on the right track.
Have two textboxes, both located in the same absolute position (inside a container element if necessary). Fill them both with their correct values. Then just control their visibility by toggling their Hidden property with an expression:
=(Parameters!UserLevel.Value = 'Admin')
Obviously UserLevel is the name of the parameter being passed in to the report. The 'Admin' value is for illustrative purposes, personally i would use an int value to represent the user level, much like using an enum.
Remember that it is the Hidden property you are setting, so you have to reverse the logic you would have used if you were setting a Visible property :)