473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Filter report using employee number

2
Hi, i have an access table that contains information about how many employees worked on a particular vehicle, it has 4 fields for employees with there employee numbers (Empl_Name1, Empl_ManNo1 and Empl_Name2, Empl_ManNo2 repectively.) I want to filter the report using the employee number and and its displaying the entire row from the table.

How can i filter and display a report with that just record that i need.

Thanks in advance
Jul 16 '14 #1
3 986
Seth Schrock
2,965 Expert 2GB
If you have the option of redesigning your table structure, you should look at Database Normalization and Table Structures. Having your database normalized would make this much simpler and also keep you from having to redesign if you would ever need to have five employees working on a vehicle.

If redesigning isn't an option, then we will have to do it the hard way. I would recommend basing the table on a query and then having your WHERE clause do the filtering instead of the report's Filter property. Then I would have a form that would have a control (textbox or combo box) that would supply the search criteria. I'll call this form frmSearch with the textbox control called txtEmpNo. The query would then look like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM YourTableName
  3. WHERE Empl_ManNo1 = Forms!frmSearch!txtEmpNo 
  4.    OR Empl_ManNo2 = Forms!frmSearch!txtEmpNo 
  5.    OR Empl_ManNo3 = Forms!frmSearch!txtEmpNo
  6.    OR Empl_ManNo4 = Forms!frmSearch!txtEmpNO
All you would have to do is enter the employee number for the person you are looking for into the textbox and then run your report.

This would be much simpler if the tables were normalized.
Jul 16 '14 #2
chuma
2
Thanks Seth, i will try the hard way first then if i fail will consider redesigning
Jul 16 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Seth is correct that this DB should be properly normalized.

Another method would be to create another field in your query, which speicifically matches your desired Emplyee ID:

Expand|Select|Wrap|Line Numbers
  1. SELECT *, IIf(Empl_ManNo1 = Forms!frmSearch!, txtEmpNo, 
  2.     IIf(Empl_ManNo2 = Forms!frmSearch!, txtEmpNo, 
  3.     IIf(Empl_ManNo3 = Forms!frmSearch!, txtEmpNo, 
  4.     IIf(Empl_ManNo4 = Forms!frmSearch!, txtEmpNo, 0)))) AS MyEmp
  5. FROM YourTableName 
  6. WHERE IIf(Empl_ManNo1 = Forms!frmSearch!, txtEmpNo, 
  7.     IIf(Empl_ManNo2 = Forms!frmSearch!, txtEmpNo, 
  8.     IIf(Empl_ManNo3 = Forms!frmSearch!, txtEmpNo, 
  9.     IIf(Empl_ManNo4 = Forms!frmSearch!, txtEmpNo, 0)))) <> 0
Then, in your report, or wherever you need the data, you simply refer to MyEmp as the field name.

Either way, it is ugly and will probably cause problems in the future.
Jul 16 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Belebala | last post by:
I have the code for filtering report on multiple selections in a list box, but how do I modify the following code to use "like" operator instead of "in". I tried to replace: strWhere = " LIKE ('*"...
2
by: Hellotalktome13 | last post by:
Using a simple ASP.net page with a crystal report on it. Loading from IIS using Integrated Secruity in the reports connection string it populates the report in the browser. What User ID and...
1
by: Cara Murphy | last post by:
Hi There! Hoping you are able to help me with a filtering scenario: I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which...
12
by: HowHow | last post by:
I need to create a few reports using one query and I wish to do the program filter from the buttons in a form. I had created a query named q_ClientsHvServices and a report based on that query named...
0
by: amiga500 | last post by:
Hello, I am developing a crystal report called Expense Report (I am not an expert Crystal Report designer) if someone could help me in this problem I would be greatly appreciate it. The report...
3
by: ambi21hs | last post by:
i need a validation code in c for employee number, only number should be allowed can any one help me out with dis..
0
by: balurajeev | last post by:
Hi friends , I want to create a Crystal report in C# using Parameterised Storred Procedure This is my Stored Procedure ALTER proc . ( @fname varchar(50), @lname varchar(50),
2
by: jim190 | last post by:
I am relatively new to using VBA and am have been trying for two days to pass a user entered value to my report for filtering when opened. I have the following subroutine in the open event of my...
2
by: phill86 | last post by:
Hi, I am filtering a report using the form filter with the following code DoCmd.OpenReport "report1", acViewReport, , Me.filter Which works fine untill I filter the form on one of the...
5
by: SPC Camp | last post by:
I am trying to build a db to report the deficiencies/strengths of security. We have about 1000 criterion that we base these on. I am trying to set it up to where we can specify which criteria they...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.