Luan
New member
- Local time
- Today, 10:22
- Joined
- Aug 4, 2021
- Messages
- 4
Hi everybody,
I am having a question about filtering in subform, I am not sure if the thread title is correct. Hope that you can help me solve this problem.
I have an access file to input and show some product information (as the first image). After double clicking a row in subform Information (SF_Info), below tabs (contain other subforms) will change. Everything works fine if 1 row in SF_Info link to 1 row in each below subform. But when I added a new subform LabTest (SF_LabTest), 1 row in SF_Info link to many rows in SF_LabTest, Access showed "Run-time error 2465: Microsoft Access can't find the field in 'SF_Labtest' reffered in your expression."
I chose SF_LabTest default view as Continuous form in order to show many results linked to a product information.
Please note that:
In table Info (related to subform Info), the primary key is InfoID
In other tables (related to other subforms), InfoID is the foreign key
This is my VBA code used to filter subform
Thanks for reading my question.
I am having a question about filtering in subform, I am not sure if the thread title is correct. Hope that you can help me solve this problem.
I have an access file to input and show some product information (as the first image). After double clicking a row in subform Information (SF_Info), below tabs (contain other subforms) will change. Everything works fine if 1 row in SF_Info link to 1 row in each below subform. But when I added a new subform LabTest (SF_LabTest), 1 row in SF_Info link to many rows in SF_LabTest, Access showed "Run-time error 2465: Microsoft Access can't find the field in 'SF_Labtest' reffered in your expression."
I chose SF_LabTest default view as Continuous form in order to show many results linked to a product information.
Please note that:
In table Info (related to subform Info), the primary key is InfoID
In other tables (related to other subforms), InfoID is the foreign key
This is my VBA code used to filter subform
Code:
Private Sub Customer_DblClick(Cancel As Integer)
'These lines work perfectly'
Forms("F_Main")("SF_Material").Form.Filter = "[InfoID]= " & Me.InfoID.Value
Forms("F_Main")("SF_Material").Form.FilterOn = True
Forms("F_Main")("SF_Print").Form.Filter = "[InfoID]= " & Me.InfoID.Value
Forms("F_Main")("SF_Print").Form.FilterOn = True
.....
'Filter in SF_Labtest does not work'
Forms("F_Main")("SF_LabTest").Form.Filter = "[InfoID]= " & Me.InfoID.Value
Forms("F_Main")("SF_LabTest").Form.FilterOn = True
End sub
Thanks for reading my question.