Hi guys, 1st time poster, long time lurker ; )
I know this issue has been covered a number of times, but I've been experiencing problems applying the various solutions listed to my problem.
Basically, I have a form (frmCompany) which lists Company Details and a linked subform (frmContractsSubform) as a datasheet that shows the Company's Contracts that I would like to filter to show grouped records, particularly by the field "ContractYear" which lists the year the Contract became active, 2001, 2002 and so on.
I would like the user to be able to Select a year value from a ComboBox on the main form that will then filter the corresponding records for the linked company subform datasheet.
I have attempted to use the following code:
I figured that once I have the concept down, I can apply it to other fields.
Any advise or assitance would be greatly appreicated, and apologies in advance if this question is somewhat idiotic
I know this issue has been covered a number of times, but I've been experiencing problems applying the various solutions listed to my problem.
Basically, I have a form (frmCompany) which lists Company Details and a linked subform (frmContractsSubform) as a datasheet that shows the Company's Contracts that I would like to filter to show grouped records, particularly by the field "ContractYear" which lists the year the Contract became active, 2001, 2002 and so on.
I would like the user to be able to Select a year value from a ComboBox on the main form that will then filter the corresponding records for the linked company subform datasheet.
I have attempted to use the following code:
Private Sub cboFilterYear_AfterUpdate()
Me.frmContractsSubform.Form.Filter = "[ContractYear] = " & Me.cboFilterYear
End Sub
I have also tried including the following code as a second line:
Me.frmContractsSubform.Form.FilterOn = True
But receive the error: Runtime Error '3071' the expression is typed incorrectly.Me.frmContractsSubform.Form.Filter = "[ContractYear] = " & Me.cboFilterYear
End Sub
I have also tried including the following code as a second line:
Me.frmContractsSubform.Form.FilterOn = True
I figured that once I have the concept down, I can apply it to other fields.
Any advise or assitance would be greatly appreicated, and apologies in advance if this question is somewhat idiotic