473,396 Members | 1,853 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,396 software developers and data experts.

Create Report with one user name and dates

17
I have a report that I have created and I have a VBA as well but it is only pulling in the dates like start and end it is not allowing me to pull in the employee name as well so that I can produce a report by specific dates and by a specific employee. What am I doing wrong.
Apr 18 '17 #1

✓ answered by NeoPa

So, we have two tables; Dates, Tech ID & Manager ID in the [Outages] table and Employee ID & Employee Name in the [Employees] table.

You want to see Techs and all Outage data that falls between two dates entered onto your form as filter parameters. You make no mention of wanting to see the manager data so I'll ignore that for now.

BTW A better approach (See Database Normalisation and Table Structures) would be to have the manager associated with the tech directly rather than entered every time in the Outages data - unless you are worried about techs changing their managers over time. I'll leave that with you to consider.

The following SQL should give you what you need. To understand what I did with the dates have a look at Time Interval Overlapping (MS Access 2003) :
Expand|Select|Wrap|Line Numbers
  1. SELECT [Employees].*
  2.      , [Outages].*
  3. FROM   [Employees]
  4.        LEFT JOIN
  5.        [Outages]
  6.   ON   [Employees].[EmployeeID]=[Outages].[TechID]
  7. WHERE  ([Outages].[FromDT]<[EndDT])
  8.   AND  ([Outages].[ToDT]>[StartDT])
NB. [FromDT] & [ToDT] are both points in time. Date fields holding both date and time. This is also true of [StartDT] & [EndDT] which I assume are extracted from a form somewhere, but if not set elsewhere they will be prompted for automatically when the query runs. A date without any time element is essentially the midnight at the start of that day.

Obviously, you know the fields you need better than I so I've left all fields in the query. Once you have it running you can change that easily to specify just what you need from each table.

9 909
NeoPa
32,556 Expert Mod 16PB
DTolemy:
What am I doing wrong.
You have asked a question without first giving enough thought to what it is you're trying to ask for. As it stands it makes very little sense. It suffers greatly from a lack of information and context.
Apr 19 '17 #2
dtolemy
17
I have a DB that I created that contains Outages that we have. I have the techs assigned to the outage along with their manager that they report to. I also have the date the incident occurred and the date it was resolved. The issue I am having is that I want to be able to report the outages by the Tech that was assigned to them along with the start and end date of each outage.

I have created a report and I can either pull in the start and end dates or the tech, but not both at the same time. I have tried multiple things by creating different Events with VBA Code and can not get them to work together. I know it can be done, I am just not sure how to do it. That is why I am asking for help. I also understand your response and hope that this is much clearer.
Apr 19 '17 #3
NeoPa
32,556 Expert Mod 16PB
Hi.

It's still not fully clear, but the attempt is always appreciated. I suspect with more practice and experience you'll see more easily what is relevant and needs to be included. One point to realise is that this work of stipulating a question correctly is nearly always extremely helpful to the original poster of the question (You in this case). We here who've seen a few questions over the years can tell you that so many questions become unnecessary once the poster has fully worked out what they need to ask.

In this case it seems like there are multiple tables. I'm guessing to a certain extent so tell me if I go off-piste at all. What is stored in which table is critical to understanding how the tables should be joined within a query to produce something the report could use.

I assume you have an Outages table of some sort. I'll refer to it here for simplicity as [tblOutage]. It would have two date fields for the start and end we'll refer to here as [StartDate] & [EndDate]. It would also have a PK (Primary Key) that identifies each item uniquely (Possibly [OutageID]). Another table contains personnel for holding the tech and their manager. Again, we'll refer to it here as tblPersonnel unless/until we hear otherwise. If the table contained a PK field ([PersonnelID]) then we could also use that to indicate who is the manager of each entry.

Do you have data in roughly that setup? That's the sort of basic understanding we'd need in order to get to the query, which is your requirement.
Apr 19 '17 #4
dtolemy
17
You are correct, I have a table called outages that holds my dates and all of the data as it is input. I also have a table called Employees that holds my Tech Names and their managers. My outage table also has the tech and manager name, but when I set them up in the outage table, I set them up as numerical fields so when I look at the data in a datasheet view instead of seeing the actual names I see the numbers associated to them.

All I want to do is be able to select and report on the tech by select dates. I really appreciate your help and understanding on this. I am really trying to get it right.
Apr 20 '17 #5
NeoPa
32,556 Expert Mod 16PB
So, we have two tables; Dates, Tech ID & Manager ID in the [Outages] table and Employee ID & Employee Name in the [Employees] table.

You want to see Techs and all Outage data that falls between two dates entered onto your form as filter parameters. You make no mention of wanting to see the manager data so I'll ignore that for now.

BTW A better approach (See Database Normalisation and Table Structures) would be to have the manager associated with the tech directly rather than entered every time in the Outages data - unless you are worried about techs changing their managers over time. I'll leave that with you to consider.

The following SQL should give you what you need. To understand what I did with the dates have a look at Time Interval Overlapping (MS Access 2003) :
Expand|Select|Wrap|Line Numbers
  1. SELECT [Employees].*
  2.      , [Outages].*
  3. FROM   [Employees]
  4.        LEFT JOIN
  5.        [Outages]
  6.   ON   [Employees].[EmployeeID]=[Outages].[TechID]
  7. WHERE  ([Outages].[FromDT]<[EndDT])
  8.   AND  ([Outages].[ToDT]>[StartDT])
NB. [FromDT] & [ToDT] are both points in time. Date fields holding both date and time. This is also true of [StartDT] & [EndDT] which I assume are extracted from a form somewhere, but if not set elsewhere they will be prompted for automatically when the query runs. A date without any time element is essentially the midnight at the start of that day.

Obviously, you know the fields you need better than I so I've left all fields in the query. Once you have it running you can change that easily to specify just what you need from each table.
Apr 20 '17 #6
TDawg
2
Not sure if that query will work. I don't believe that it will return any records. If the StartDT and EndDT are listed as May 1 through May 31 and in the table we have a record that was opened (FromDT) on May 5 and closed (ToDT) on May 7, then you are saying return all records where May 5 < May 31 and May 7 < May 1. I think it needs to be ToDT >= StartDT.
Apr 20 '17 #7
NeoPa
32,556 Expert Mod 16PB
TDawg:
I think it needs to be ToDT >= StartDT.
I could have sworn I fixed that before posting. Thanks for catching it.

I don't believe the "=" is needed in this instance as I don't imagine a job finishing at the time the window starts would be considered to be within the window, but if you or the OP disagree then that's an option.
Apr 20 '17 #8
dtolemy
17
I wanted to thank you for your help. I have decided to go back to the drawing board and completely redo my DB. I think I can stream line it more now and really get it to do what I need it to do. As you stated plan, plan plan. Thanks again
Apr 21 '17 #9
NeoPa
32,556 Expert Mod 16PB
That's a courageous (I saw your database don't forget), but ultimately wise decision. It will mean a deal of work, but what you will learn during that process will certainly serve you well going forward.

Best of luck.
Apr 22 '17 #10

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

Similar topics

5
by: Mike Turco | last post by:
(This was also posted to comp.database.ms-access before I realized this was the hep group.) Lets say that my WinXP computer has two users: Michael and Kathryn. One or the other logs into the...
15
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the...
2
by: Jean-Claude Bertrand | last post by:
Hello to all .Net programmers! I am a consultant and I create very small application for small enterprise. Most of the time in my application, the number of users is under 5! I still program...
1
by: richb330 | last post by:
I'm trying to set up a program that will create a user account within active directory based on a number of parameters selected on a form. The following code should, i believe, create a user...
6
by: Jozef | last post by:
Hello, I've set up VS2003 on my laptop which is running Win XP pro in a stand alone situation, no domain or dc. When I try and "Create a blank solution", I use the Laptop IP address since...
1
by: brig | last post by:
Hi All, I have a Table (STDTable) with 3 columns: STDAccount, STDpassword, IRowId. I am getting a user conflicts error when I 'get the next' user info from the table. I am using SQLDeveloper. ...
1
by: tbehmand | last post by:
Hi I am getting the following message when I click on 'Create report in Design view', does anyone know how to fix this. "There was a problem retrieving printer information for this object. The...
0
by: bdmir | last post by:
Hello, I have a text file(tab delim) with data and I want to create report. Here is the content of text file: HD John Smith j.smith@testmail.com CT service 1 5$ CT service2 1 6$ CT service3 4...
2
by: michael george | last post by:
Hi, I am a recreational user of access and I enjoy making small databases. My question is when I add records to a form i want to create a report on the form currently displayed on screen, at the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.