I am trying to filter records in a primary form based on records in
related tables. The data in the related tables is being displayed in
the primary form
through subforms. To be more specific, I have a primary form named
TestResults, which is connected to data in a table named TestResults.
There are basically two other tables that are related to the
TestResults table (and the primary form) named Names-Normalized and
SiteAddresses. The Names-Normalized table is a one-to-many
relationship with the TestResults table (with the Names-Normalized on
the many side), and SiteAddress is a one-to-one relationship with the
TestResults table. Both tables are related via the TestID value. The
Names-Normalized table has the following fields: TestID, LastName, and
FirstName. Both the Names-Normalized and the SiteAddress data are
displayed in a subform on the primary form; each based on a query that
is used only to display certain parts of the records from each table
into the subform.
I need a user to be able to do the following:
A)Type in a users Last Name (in a textbox)and filter those records in
the primary form that have the same TestID (e.g. Last Name = Johnson,
Johnson returns 3 different TestIDs, filter those records with the
same TestID in the primary form).
B) Same has (A) for the SiteAddresses, though the filtering could be
done through a combo box.
I currently have an unbound text box on the primary form with the
following code (used for filtering Last Name):
Private Sub NameFilter_AfterUpdate()
Me.Filter = "TestID In(SELECT TestID FROM Names-Normalized WHERE
[LastName] = '" & Me!NameFilter & "')"
Me.FilterOn = True
End Sub
I get the following error:
Run Time Error 2448
You can not assign a value to this object.
Any ideas on resolving this problem will be greatly appreciated.
Thanks in advance.