Access 7007 and SQL Server 2008 R2.
I have two Parent Forms on one screen, no Sub Forms. So they are not linked as Parent and Child. The First form applies a filter to the Second form. The First Form contains a field called "TaxYear". You double click the TaxYear field (running the code below) and it filters the second form so that the Second Form SPYDTaxYear = the First Form's TaxYear.
The filter by SPYDTaxYear works fine. I need to quickly add a second criteria to the filter called, "PropertyID", an integer. So, on the First Form you double click on the TaxYear field and it should filter the Second Form by both SPYDTaxYear and PropertyID.
Code:
This filter by Tax Year works fine.
Private Sub TaxYear_DblClick(Cancel As Integer)
Dim stTaxYear As String 'From First Form
stTaxYear = Me.TaxYear 'From First Form
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.FilterOn = False
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.Filter = "[SPYDTaxYear]= '" & stTaxYear & "'"
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.FilterOn = True
The above filter works but it needs a second filter criteria of the PropertyID, an integer.
My modification of the above filter after adding [PropertyID] errors out with a data type mismatch.
Private Sub TaxYear_DblClick(Cancel As Integer)
lngPropid = Me.PropertyID
stTaxYear = Me.TaxYear
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.FilterOn = False
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.Filter = ("[SPYDTaxYear]= '" & stTaxYear & "' and "[Propertyid]= " & lngPropid &"')"
Forms![Frm_RecordstatusFrame]![Frm_SPYDTaxYears2].Form.FilterOn = True
So the only thing I need is correct the filter so that it includes SPYDPropertyID which is an integer.
I am prepping for a demo today at 10:00 AM. This is the last issue that is still not working correctly.
I am continuing to work on this but I also posted this for additional help.
Thanks Phred.