ACC97: Hyperlink Is Not Displayed as Expected in Report Header

ID: Q191100


The information in this article applies to:

Moderate: Requires basic macro, coding, and interoperability skills.


SYMPTOMS

When you place a Hyperlink field in a report header or section header, it may not be displayed in the proper format. The text box is displayed with number signs (#), as shown below, instead of just "Display Text" or "Link to File or URL:"


RESOLUTION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
You can use the following function to eliminate the unwanted number signs.
  1. Open the sample database Northwind.mdb.


  2. Create a module and type the following line in the Declarations section:


  3. 
    Option Explicit 
  4. Type or paste the following procedure into the module:


  5. 
    
          Public Function FParseHyperlink(strHyp As String) As String
    
             ' Determine if there is a '#' sign in the field.
             If InStr(1, strHyp, "#") > 0 Then
    
                ' Check the first character of the hyperlink.
                ' If it is a '#', then no Display Text has
                ' been entered for the hyperlink; output the
                ' Link to File URL.
                If Left(strHyp, 1) = "#" Then
                   If InStr(1, Right(strHyp, Len(strHyp) - 1), "#") Then
                      FParseHyperlink = Left(Right(strHyp, Len(strHyp) - 1), _
                        InStr(1, Right(strHyp, Len(strHyp) - 1), "#") - 1)
                   End If
                Else
    
                   ' If the first character was something other than '#',
                   ' output the Display Text for field.
                   FParseHyperlink = Left(strHyp, InStr(1, strHyp, "#") - 1)
    
                End If
             End If
          End Function 
  6. On the File menu, click Save. Type HyperlinkFunction, and then click OK.


To test this function, follow these steps:
  1. In the Database window, click the Tables tab and select the Suppliers table. On the Insert menu, click Report. Click AutoReport: Columnar, and then click OK.


  2. On the View menu, click Design View.


  3. On the View menu, click Sorting And Grouping.


  4. In the Sorting And Grouping dialog box, select SupplierID from the Field/Expression box, and set the following properties:


  5. 
       Group Header: Yes 
  6. Add a text box to the SupplierID header section of the report, and set the following properties:


  7. 
    Control Source: =IIf(IsNull([HomePage])=False,FParseHyperlink([HomePage]))
    Fore Color: 16711680
    Font Underline: Yes 
  8. On the File menu, click Save. Type Hyperlink-Format, and then click OK.


  9. On the File menu, click Print Preview.


The new text box will look like a hyperlink and is displayed in the proper format. Although the field looks like a hyperlink, it does not function as a hyperlink because hyperlinks are not clickable on a report.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 97


MORE INFORMATION

Steps to Reproduce Problem

  1. Open the sample database Northwind.mdb.


  2. In the Database window, click the Tables tab and select the Suppliers table. On the Insert menu, click Report. Click AutoReport: Columnar, and then click OK.


  3. On the View menu, click Design View.


  4. On the View menu, click Sorting And Grouping.


  5. In the Sorting And Grouping dialog box, select SupplierID from the Field/Expression box, and set the following properties:


  6. 
       Group Header: Yes 
  7. Drag the HomePage label and text box to the Supplier ID header section.


  8. On the File menu, click Save. Type Hyperlink-NoFormat, and then click OK.


  9. On the File menu, click Print Preview.


Note the number signs (#) surrounding the HomePage text boxes that have a value.


REFERENCES

For more information about creating hyperlinks, search the Help Index for "hyperlink fields," or ask the Office Assistant.

Additional query words: pra URL web site address


Keywords          : kbdta RptProb 
Version           : WINDOWS:97
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 13, 1999