Microsoft KB Archive/293148

= ACC2002: Microsoft Access Project Form Displays #Name? in Print Preview =

Article ID: 293148

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q293148



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access project (.adp).



SYMPTOMS
When you view an Access project form that has a Server Filter applied to it in print preview, the form loses its connection to its record source and #Name is displayed in all of the data controls.



CAUSE
This problem occurs when the Min and Max buttons of the form are disabled.



RESOLUTION
The best solution is to leave the MinMaxButton property of the form set to Both Enabled, and then to use the following code in the OnOpen event procedure of the form to hide the Min and Max buttons.

First, add the following application programming interface (API) declaration to any module in the database.

Declare Function SetWindowLong Lib &quot;user32&quot; Alias &quot;SetWindowLongA&quot; _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Declare Function GetWindowLong Lib &quot;user32&quot; Alias &quot;GetWindowLongA&quot; _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Const WS_MINIMIZEBOX = &H20000 Public Const WS_MAXIMIZEBOX = &H10000 Public Const GWL_STYLE = (-16)

Then add the following code to the OnOpen event procedure of the form to automatically hide the Min and Max buttons when the form is opened.

Private Sub Form_Load SetWindowLong Me.hwnd, GWL_STYLE, GetWindowLong(Me.hwnd, _      GWL_STYLE) And Not (WS_MAXIMIZEBOX Or WS_MINIMIZEBOX) End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior

 * 1) Open the Customers form in the NorthwindCS.adp in Design view.
 * 2) Set the MinMaxButtons property to None.
 * 3) Set the ServerFilterByForm property to Yes.
 * 4) View the form in Form view, and then type Like 'A%' for the Company Name field.
 * 5) Apply the filter, and then print preview the form.

Note that in print preview, every data control displays #Name?.

Additional query words: pra pound name question mark

Keywords: kbbug kbnofix KB293148

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.