Show All as Criteria

arifmasum

Registered User.
Local time
Tomorrow, 05:46
Joined
Dec 10, 2007
Messages
72
Dear Experts,

A am stuck here. I want to show leave report of Every Employee of a department in reports. I need "All" as combo box criteria, but can not understand how I can do it.

Will anybody help me out of this issue?

Thanks in advance.

Arif Masum
 
Simple Software Solutions

I assume you have a combo box that the user can select from, if they wish. However, you want the list to contain the option "All" so if the user clicks on this then all the people in the list are printed.

The most simplest method is to stick a label under the combo box or a tool tip text on the combo box to tell the user to leave blank for all people in list.
 
The standard way is usually to replace your combobox RowSource with this

Code:
SELECT YourField FROM YourTable
UNION SELECT "<All>" FROM YourTable;
filling in your actual field and table names.

Then use this code in the AfterUpdate of your combobox, once again filling in the actual name of your combobox:
Code:
Private Sub YourCombobox_AfterUpdate()
  If Me.YourCombobox = "<All>" Then
    ' Run code here to run report without any criteria (in other words, [B]with all employees[/B]) 
  Else
    'Run code you're using to run the report [B]with[/B] given employees  
End If
End Sub

Linq
 
Thanks a lot Linq. You made it so easily. I understood. Best regards.

Arif Masum
 

Users who are viewing this thread

Back
Top Bottom