PC Review

Thread Tools Rate Thread

Open report to current year

Billy B
Posts: n/a
      25th May 2010
I have a form with a combo box for the user to select criteria to open a
report. The following code works but I want to add the criteria that the
records displayed only the current year not all years. Any help will be

Private Sub cmdListCodes_Click()
Dim strFilter As String
Dim varItem As Variant

With lstCodeNumbers
If .MultiSelect = 0 Then
strFilter = "[Code] = " & .Value
For Each varItem In .ItemsSelected
strFilter = strFilter & "," & .ItemData(varItem)
Next varItem

If Len(strFilter) > 0 Then
If .ItemsSelected.Count = 1 Then
strFilter = "[Code] = " & Mid$(strFilter, 2)
strFilter = "[Code] In(" & Mid$(strFilter, 2) & ")"
End If
End If
End If
End With

'Clear the listbox selected items
With lstCodeNumbers
For Each varItem In .ItemsSelected
.Selected(varItem) = False
Next varItem
End With

'Open the report with the selected Codes
DoCmd.OpenReport "rptTestDescCode", acViewPreview, WhereCondition:=strFilter

End Sub
Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
current week, current month, current year joemeshuggah Microsoft Excel Programming 1 14th Oct 2008 06:44 PM
add one year to current year Claudia Fong Microsoft C# .NET 2 7th Jun 2005 05:58 AM
How to compare current year to prior year in bar chart? =?Utf-8?B?c3Vic3RyaW5n?= Microsoft Excel Charting 4 12th May 2005 07:04 PM
Date syntax to show a year ago from current year and day Dave Elliott Microsoft Access Forms 1 4th Jan 2005 09:26 PM
Comparing current year and prior year data in one report =?Utf-8?B?c3doaXRl?= Microsoft Access Reports 5 24th Feb 2004 04:52 AM




All times are GMT +1. The time now is 11:16 PM.