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
- Start Access 2003.
- On the Help menu, point to Sample
Databases, and then click Northwind Sample
Database.
- On the Northwind Traders splash screen appears, click
OK, and then click the Close button in
the Main Switchboard dialog box.
- In the Objects pane, click
Tables, right-click Customers, and then click
Design View.
- 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
- Click Save, and then close the
Customers table.
- 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
- In the Objects pane, click
Pages, and then click New.
- 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.
- On the File menu, click
Save, type OrdersDAP.htm in the
File name box, and then click
Save.
- 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.
- In the Northwind : Database (Access 2000 file
format) dialog box, click Pages in the
Objects pane, and then click New.
- 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.
- On the File menu, click
Save, type CustomersDAP.htm in the
File name box, and then click
Save.
- 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
- In the Northwind : Database (Access 2000 file
format) dialog box, click CustomersDAP, and then
click Design.
- Click Command
Button in the toolbox, and then click a blank area on the page.
- In the Command Button Wizard,
click Cancel.
- Right-click the new command button, and then click Element Properties.
- Click the Other tab, type
OrdersButton in the ID box, and then type
Orders in the InnerText box.
- Right-click the new command button, and then click Microsoft Script Editor.
- 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>
- On the File menu, click
Save, and then on the File menu, click
Exit to close the Microsoft Script Editor.
- On the File menu in Access,
click Save.
Open
CustomersDAP.htm in Microsoft Internet Explorer
to test the new command button.