Filter Subform B Based on Field in Subform A
I cannot get Access XP (2002) to recognize a subform's Filter property in this situation. Perhaps you can help me get the correct VBA.
Situation: Unbound Main form is open. It has two subforms, A and B. Both A and B are in datasheet view. Subforms A and B are based on two tables with one common field called lngFieldA.
What I want: When the cursor is placed inside txtFieldA in Subform A (i.e. txtFieldA has the focus), I want Subform's B filter to change. Right now, I have this in (Subform A) txtFieldA's On Got Focus event.
Me.Parent.Form.sfrSubformB.Form.Filter = "[lngFieldA] = " & Me.txtFieldA
That is, whatever value the cursor sits on in Subform A Field A, make SubformB's filter change so only Subform B Field A values are shown. However, I'm getting an error message saying that the filter property is not valid. Why not? I can do this:
MsgBox Me.Parent.Form.sfrSubformB.Form.Name, vbInformation, "Name"
and it will actually pop up a message box that says, "sfrSubformB". So if the .Name property works, why doesn't the .Filter property work? :(
Michigan Dept. of Environmental Quality, Air Quality Division
Michigan Dept. of Environmental Quality
Air Quality Division