Senin, 03 Oktober 2016

Re: [MS_AccessPros] Help with filtering report

 

Kat-


You don't need to change your code as long as you change the Row Source of the EmpName combo box.  What you need is a "null" or empty value  added to the list.

Row Source: 
SELECT Employees.EmpName, Employees.EmpName As Display
FROM Employees
UNION 
SELECT Null, "<All Employees>"
FROM Employees
ORDER BY 2;

Set the Bound Column to 1 and the Display Widths to 0"; 1.5"

If the user selects an employee name, the name will be returned by the combo box.  If the user selects <All Employees>, the box will go blank and return a Null value - which will keep your code from adding a filter.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Oct 3, 2016, at 10:53 PM, ka0t1c_ang3l <no_reply@yahoogroups.com> wrote:



Hello,


I have a form which has several unbound text boxes for start and end date, employee name, training class, and the form also has several option buttons for different reports.  One of the option buttons is for a report that will display training history for a specific employee.  Currently an employee name and training class must be selected from the combo box, and the option button for training history for specific employee option button must be selected, and the report will display the history for that employee and specified training class.  I would like the option to type in an "*" as a wildcard indicating all values, and when the training history for specific employee button is selected, it will open the report which will display all the training records for the selected employee.  This is the code i have currently for that option button:


Case Is = 8

     If Not IsNull(Me.EmpName) Then
          strWhere = strWhere & " AND [NAME] = """ & Me.EmpName & """ "
       End If
     If Not IsNull(Me.CDesc) Then
          strWhere = strWhere & " AND [Desc] = """ & Me.CDesc & """ "
       End If
       strReport = "R_TrnHist4SpecificEmp"


Any help is great appreciated!!

Thanks!

Kat



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar