A
Ac
Hi
I created a form will display the records from a table. The records in the
table contain years (mm/dd/yyyy) information. I would like to write the code
to retrieve the records based on the year range. For example, retrieve all
data from year 2000 or data from 2001.
Here is my original idea, and it does not work. Please help me. Thanks
Private Sub Form_Load()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "AllRecords"
If Form!Start![cboYear] = 2000 Then ‘based on the combo box
selection
stLinkCriteria = [EffectiveDate] >= 1 / 1 / 2000 And [ExpirationDate] <=
12 / 31 / 2001 ‘select the data based on the year range
DoCmd.OpenForm stDocName, , , stLinkCriteria
'lblAll = "2000 All"
'lblTotal = "Total (2000 only)"
End If
End Sub
I created a form will display the records from a table. The records in the
table contain years (mm/dd/yyyy) information. I would like to write the code
to retrieve the records based on the year range. For example, retrieve all
data from year 2000 or data from 2001.
Here is my original idea, and it does not work. Please help me. Thanks
Private Sub Form_Load()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "AllRecords"
If Form!Start![cboYear] = 2000 Then ‘based on the combo box
selection
stLinkCriteria = [EffectiveDate] >= 1 / 1 / 2000 And [ExpirationDate] <=
12 / 31 / 2001 ‘select the data based on the year range
DoCmd.OpenForm stDocName, , , stLinkCriteria
'lblAll = "2000 All"
'lblTotal = "Total (2000 only)"
End If
End Sub