ACC97: HTML: Search for Hyperlink Fails with Specified Criteria

ID: Q164773

The information in this article applies to:

SYMPTOMS

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

When you type a hyperlink address on the Criteria line in a query to return all records associated with that hyperlink, no records are returned, even though records that meet the specified criteria do exist in the table.

 

CAUSE

Microsoft Access Hyperlink fields consist of the following three sections separated by number signs (#): the Displaytext, the Address, and the Subaddress. When you view these fields in a datasheet, a form, or a report, Microsoft Access just displays the Displaytext portion of the fields. Therefore, to return records where the Displaytext or Address is a string, you must put an asterisk (*) on either side of the string.

RESOLUTION

When you search for a hyperlink address, you must include the asterisk character (*) in your search argument. For example, to retrieve all records that contain www.microsoft.com, you would type:

   Like "*www.microsoft.com*"

MORE INFORMATION

Steps to Reproduce Behavior

1. Open the sample database Northwind.mdb.

2. Open the Suppliers Table and scroll to the HomePage field. Note the

   names of the first two Home pages you can link to:

       CAJUN.HTM
       Mayumi's (on the World Wide Web)

3. Close the Suppliers table.

4. Create a query based on the Suppliers table and add the HomePage

   field to the query grid.

5. Type the following on the Criteria line:

       "CAJUN.HTM" or "Mayumi's (on the World Wide Web)"

6. Run the query and note that no records are returned.

7. Switch back to Design view of the query and type the following on the

   Criteria line:

      "#CAJUN.HTM#"  or "*Mayumi's (on the World Wide Web)*"

   Note that the correct records are returned.

   NOTE: In order to understand this method of searching, you must know
   what part of the hyperlink field Microsoft Access is showing in
   Datasheet view. A simple way to see this is to do the following:

    a. Create a query based on the Suppliers table.

    b. Add the HomePage field to the query grid.

    c. Create the following expression: expr1:mid([HomePage],1).

    d. Run the query.

You can now see the entire contents of the field, including the number signs (#). This can help you identify what criteria will work best for you in your searches.

REFERENCES

For more information about Hyperlink fields, search the Help Index for "hyperlink fields and controls," or ask the Microsoft Access 97 Office Assistant.

Additional query words:

Keywords          : kbusage
Version           : 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbprb

Last Reviewed: November 18, 1998