Microsoft KB Archive/175219
Article ID: 175219
Article Last Modified on 1/22/2007
- Microsoft Access 97 Standard Edition
This article was previously published under Q175219
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the AutoFormat feature on a form that contains a hyperlink, the default color for the hyperlink text is changed.
By default, the hyperlink color will be what is specified in the Followed Hyperlink Color or Hyperlink Color box on the Hyperlinks/HTML tab of the Options dialog box. However, because the hyperlink control is considered a label, it uses the default color specified for labels in the format selected with the AutoFormat feature.
There are two methods that you can use to set the color for the hyperlink text:
- You can set the color for the hyperlink text by using the ForeColor property for the control.
- You can specify the color of the hyperlink text by using code.
- Using the right mouse button (right-click), click the hyperlink control, and then select Properties.
- In the Properties dialog box, click the Format tab. Scroll down to ForeColor, and select the color that you want.
- Open the form in Design view.
- On the Edit menu, click Select Form.
- On the View menu, click Properties.
- In the Form dialog box, click the Event tab, and then click in the OnCurrent box.
- Click the Build button to the right of the OnCurrent box. In the Choose Builder dialog box, select Code Builder, and then click OK.
To set the color for the text, type or paste the following sample line of code into the Sub procedure:
Me!HyperLinkControlName.ForeColor = 255
Steps to Reproduce Behavior
- Start Microsoft Access and open the sample database Northwind.mdb.
- Open the Customers form in Design view.
- Place the pointer in the Form Header. On the Insert menu, click Hyperlink. The Insert Hyperlink dialog box appears. In the "Link to file or URL:" list box, type http://www.microsoft.com, and then click OK.
- Click the Form Header section again to move the focus from the hyperlink text. On the Format menu, click AutoFormat. In the AutoFormat dialog box, under Form AutoFormats, select Standard, and then click OK. The link now appears in black.
- On the Format menu, click AutoFormat again. This time select Dusk, and then click OK. The link now appears in yellow.
For more information about the ForeColor property, search the Help Index for "ForeColor Property," or ask the Microsoft Access 97 Office Assistant.
Additional query words: prb
Keywords: kbprb KB175219