ACC2000: "An Unknown Error Has Occurred" Error Setting Form's Maximum Record Limit or Server Filter (223204)
The information in this article applies to:
This article was previously published under Q223204 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
When you do any of the following things
- click the Maximum Record Limit button
- click the Server Filter By Form button
- press F9
- press Shift+F9
you may receive the following error message:
An unknown error has occurred.
RESOLUTIONResolving the Maximum Record Limit
You can disable the built-in Max Rec button and create a custom button on your form to set the maximum number of records. The following steps show you an example of how to do this.
- Open the sample Microsoft Access project NorthwindCS.adp.
- Create a new form based on the Customers table.
- Set the MaxRecButton property of the form to No.
- Add a command button to the form and set the following properties:
Name: cmdMaxRecs
Caption: Max Records
- On the View menu, click Code, and type the following code:
Dim rs As New ADODB.Recordset
Private Sub cmdMaxRecs_Click()
Dim strSQl as String
Set rs = Nothing
'Type your own SQL statement.
strSQl = "SELECT * FROM Customers"
rs.MaxRecords = CLng(InputBox("Type desired maximum ", _
"Max Records", 10))
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset
Set Me.Recordset = rs
End Sub
- Close the Visual Basic Editor.
- On the View menu, click Form View.
Note that using the SQL statement provided, there are 91 records. - Click Max Records, and then click OK.
Note that there are only 10 records now.
Resolving the Server Filter By Form
You can create a custom button on your form to filter the number of records. The following steps show you an example of how to do this.
- Open the sample Access project NorthwindCS.adp.
- Create a new unbound form.
- Set the Server Filter By Form property to No.
- Add a text box to the form and set the ControlSource property a follows:
CompanyName
- Add a combo box to the form and set the following properties:
Name: cmbCusts
RowSource: Customers
ColumnWidths: 1"
- Add a command button to the form and set the following properties:
Name: cmdFilter
Caption: Filter
- On the View menu, click Code, and type the following code:
Private Sub cmdFilter_Click()
Me.FilterOn = True
Me.Filter = "[CustomerID] = '" & Me!cmbCusts & "'"
End Sub
- Save and run the form.
Resolving F9 or Shift+F9
Disable F9 or Shift+F9 by using AutoKeys. The following steps show you an example of how to do this.
- Open a new macro in Design view.
- On the View menu, click Macro Names.
- Create the following macro:
- Close and save the macro as AutoKeys.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/14/2004 |
---|
Keywords: | kbbug KbClientServer kbpending KB223204 |
---|
|