Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

No results are returned when you click a hyperlink in a data access page in Access 2000, Access 2002, or Access 2003


View products that this article applies to.

Symptoms

In Microsoft Access 2000, Microsoft Access 2002, or Microsoft Office Access 2003, no results are returned when you click a hyperlink in a data access page and the following conditions are true:
  • The data access page includes a hyperlink that opens another data access page.
  • The hyperlink is configured to use a server filter. For example, when you insert the hyperlink in the data access page, you click Server Filter, and you specify a server filter.

↑ Back to the top


Cause

This issue occurs if the field names that you specify in the server filter contain spaces. The user interface where you specify a server filter does not permit the correct syntax to create a server filter if the field names contain spaces. Therefore, the server filter does not work.

↑ Back to the top


Resolution

To resolve this issue, make sure that the names of the fields in your database tables do not contain spaces if you reference those field names in your server filter.

For example, if your server filter references a field such as "Customer ID," rename the Customer ID field in your database tables to a name such as "CustomerID." Then modify your server filter to reference the new field name.

↑ Back to the top


Workaround

To work around this issue, use a command button control instead of a hyperlink control in the data access page. Using a command button control requires that you add code to the onclick event to redirect users to the other data access page. To do this, follow these steps:

CAUTION If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and to follow these steps on a copy of the database.

Note For each version of Access, the location of your files may be different from the location that is specified in these steps.

Add spaces to the CustomerID field names

  1. Start Access 2003.
  2. On the Help menu, point to Sample Databases, and then click Northwind Sample Database.
  3. On the Northwind Traders splash screen appears, click OK, and then click the Close button in the Main Switchboard dialog box.
  4. In the Objects pane, click Tables, right-click Customers, and then click Design View.
  5. Click to put the insertion point between "Customer" and "ID" in the CustomerID field, and then press SPACEBAR. The CustomerID field name appears as follows:
    Customer ID
  6. Click Save, and then close the Customers table.
  7. Right-click each table that contains the CustomerID field, such as the Orders table, and then follow steps 5 through 7 to modify the CustomerID field name so that a space appears between "Customer" and "ID" in the field name.

Create new data access pages

  1. In the Objects pane, click Pages, and then click New.
  2. In the New Data Access Page dialog box, click AutoPage: Columnar, click Orders in the Choose the table or query where the object's data comes from list, and then click OK.
  3. On the File menu, click Save, type OrdersDAP.htm in the File name box, and then click Save.
  4. If the following message box appears, click OK:
    The connection string of this page specifies an absolute path. The page might not be able to connect to data through the network. To connect through the network, edit the connection string to specify a network (UNC) path.
  5. In the Northwind : Database (Access 2000 file format) dialog box, click Pages in the Objects pane, and then click New.
  6. In the New Data Access Page dialog box, click AutoPage: Columnar, click Customers in the Choose the table or query where the object's data comes from list, and then click OK.
  7. On the File menu, click Save, type CustomersDAP.htm in the File name box, and then click Save.
  8. If the following message box appears, click OK:
    The connection string of this page specifies an absolute path. The page might not be able to connect to data through the network. To connect through the network, edit the connection string to specify a network (UNC) path.

Add a command button to the CustomersDAP page

  1. In the Northwind : Database (Access 2000 file format) dialog box, click CustomersDAP, and then click Design.
  2. Click Command Button in the toolbox, and then click a blank area on the page.
  3. In the Command Button Wizard, click Cancel.
  4. Right-click the new command button, and then click Element Properties.
  5. Click the Other tab, type OrdersButton in the ID box, and then type Orders in the InnerText box.
  6. Right-click the new command button, and then click Microsoft Script Editor.
  7. In the Document Outline pane, click OrdersButton, position the insertion point after the </BUTTON> tag, and then paste the following Visual Basic script code:

    Note If you need to, modify the path of the OrdersDAP.htm file in the following code example.
    <SCRIPT language=vbscript event=onclick for=OrdersButton>
    Dim loc
    loc = "file:///C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\OrdersDAP.htm?serverfilter=" & chr(34) & "[Customer ID]='" & [Customer ID].value & "'" & chr(34)
    window.navigate loc
    </SCRIPT>
  8. On the File menu, click Save, and then on the File menu, click Exit to close the Microsoft Script Editor.
  9. On the File menu in Access, click Save.

    Open CustomersDAP.htm in Microsoft Internet Explorer to test the new command button.

↑ Back to the top


References

For additional information about how to create a script for a button on a data access page, visit the following Microsoft Web site:For additional information about how to create a data access page, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB891123, kbtshoot, kbprb

↑ Back to the top

Article Info
Article ID : 891123
Revision : 4
Created on : 1/25/2005
Published on : 1/25/2005
Exists online : False
Views : 391