Microsoft KB Archive/164773

= ACC97: HTML: Search for Hyperlink Fails with Specified Criteria =

Article ID: 164773

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q164773



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



SYMPTOMS
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, type:

Like "*www.microsoft.com*"



Steps to Reproduce Behavior
 Open the sample database Northwind.mdb. 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)

 Close the Suppliers table. Create a query based on the Suppliers table and add the HomePage field to the query grid. Type the following on the Criteria line:

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

</li> Run the query and note that no records are returned.</li> 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: <ol style="list-style-type: lower-alpha;"> Create a query based on the Suppliers table.</li> Add the HomePage field to the query grid.</li> Create the following expression: expr1:mid([HomePage],1).</li> Run the query.</li></ol> </li></ol>

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.

<div class="references_section">