T
tiger0268 via AccessMonster.com
I am having trouble filter a continuous form that list the names and final
scan dates for some applications. The form pulls from a query like so:
SELECT Names.LastName, Names.FirstName, MainTable.Final_Scan_Date
FROM [Names] INNER JOIN MainTable ON Names.Name_ID = MainTable.Names_ID
WHERE (((MainTable.Final_Scan)=Yes) AND ((MainTable.Final_Scan_Date)
<=DateSerial(Year(Date()),Month(Date())-3,0)))
GROUP BY Names.LastName, Names.FirstName, MainTable.Final_Scan_Date
ORDER BY Names.LastName, Names.FirstName, MainTable.Final_Scan_Date DESC;
It basically grabs all records that are at least three months old. I then
have like a custom made messagebox/form that takes in input from the user for
a cutoff date...i.e.( 1, 2 ,3......1 month of names, 2 month of names, or
three months of names respectively). I pass that value to the form that list
the names of applications, but I am having trouble filtering that form. This
is what I got so far:
Private Sub Form_Load()
Dim MonthHolder
Dim CloseDate
MonthHolder = Forms!ShredStart!ShredInput.Value
If (MonthHolder = 1) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 4, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
If (MonthHolder = 2) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 5, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
End If
If (MonthHolder = 3) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 6, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
End If
End Sub
I test it and no records come up. I am open to any suggestions.
Thanks in Advance
scan dates for some applications. The form pulls from a query like so:
SELECT Names.LastName, Names.FirstName, MainTable.Final_Scan_Date
FROM [Names] INNER JOIN MainTable ON Names.Name_ID = MainTable.Names_ID
WHERE (((MainTable.Final_Scan)=Yes) AND ((MainTable.Final_Scan_Date)
<=DateSerial(Year(Date()),Month(Date())-3,0)))
GROUP BY Names.LastName, Names.FirstName, MainTable.Final_Scan_Date
ORDER BY Names.LastName, Names.FirstName, MainTable.Final_Scan_Date DESC;
It basically grabs all records that are at least three months old. I then
have like a custom made messagebox/form that takes in input from the user for
a cutoff date...i.e.( 1, 2 ,3......1 month of names, 2 month of names, or
three months of names respectively). I pass that value to the form that list
the names of applications, but I am having trouble filtering that form. This
is what I got so far:
Private Sub Form_Load()
Dim MonthHolder
Dim CloseDate
MonthHolder = Forms!ShredStart!ShredInput.Value
If (MonthHolder = 1) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 4, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
If (MonthHolder = 2) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 5, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
End If
If (MonthHolder = 3) Then
CloseDate = DateSerial(Year(Date), Month(Date) - 6, 0)
Me.Filter = [Final_Scan_Date] > CloseDate
Me.FilterOn = True
End If
End Sub
I test it and no records come up. I am open to any suggestions.
Thanks in Advance