473,399 Members | 3,106 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,399 software developers and data experts.

Double Records in Report

My question is in reference to the following closed thread.

http://groups.google.com/group/comp....29479ec733This
is my current query:

This is my current query:

SELECT [DateFilter - Admin].Employee, [DateFilter - Admin].TimeTypeIn,
IIf(Sum(DateDiff("s",[clockin],[clockout]))-40*60*60>0,Sum(DateDiff("s",[cl*ockin],[clockout]))-40*60*60,0)

AS Overtime, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1 AS
WeekOf
FROM [DateFilter - Admin]
GROUP BY [DateFilter - Admin].Employee, [DateFilter -
Admin].TimeTypeIn, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1

HAVING ((([DateFilter - Admin].TimeTypeIn)="Regular"));

Bob, last posted "I cannot see why that sql is returning two records,
unless data
in one of the group by fields is not identical."

I think the line "DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS
WeekOf " of my query may be causing the problem. These field does not
produce identical records.

By keeping this in there, does anyone have suggestions on how to make
this so I don't have multiple records?

Thank you!

Brad

Jun 13 '06 #1
4 2014
Drum2001 wrote:
My question is in reference to the following closed thread.

http://groups.google.com/group/comp....29479ec733This
is my current query:

This is my current query:

SELECT [DateFilter - Admin].Employee, [DateFilter - Admin].TimeTypeIn,
IIf(Sum(DateDiff("s",[clockin],[clockout]))-40*60*60>0,Sum(DateDiff("s",[cl*ockin],[clockout]))-40*60*60,0)

AS Overtime, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1 AS
WeekOf
FROM [DateFilter - Admin]
GROUP BY [DateFilter - Admin].Employee, [DateFilter -
Admin].TimeTypeIn, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1

HAVING ((([DateFilter - Admin].TimeTypeIn)="Regular")); Bob, last posted "I cannot see why that sql is returning two records,
unless data
in one of the group by fields is not identical."

I think the line "DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS
WeekOf " of my query may be causing the problem. These field does not
produce identical records.

By keeping this in there, does anyone have suggestions on how to make
this so I don't have multiple records?

Thank you!

Brad

If I were in your situation, I might first create a new SELECT query
that simply pulls in the detail info.

SELECT Employee, TimeTypeIn,
[clockin],[clockout],DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS WeekOf
FROM [DateFilter - Admin]
Where ((([DateFilter - Admin].TimeTypeIn)="Regular"));

I don't know if it's possibe for you to do a calc on clock-in/out here.
ANyway, save the query as query 1.

Now create query 2. Use Query1 as the table. Do your summing and
grouping in this query.

I'd sooner have 2 queries that I can follow easily than 1 query that I
bust my ass over it.

Jun 15 '06 #2
Thank you for the suggestion!

When I do that, it does not subtract the "regular time".

For example:

Total Hours = 85:35:55
Overtime = 45:35:55

So it is not subtracting the "40:00:00"

Any suggestions why?



salad wrote:
Drum2001 wrote:
My question is in reference to the following closed thread.

http://groups.google.com/group/comp....29479ec733This
is my current query:

This is my current query:

SELECT [DateFilter - Admin].Employee, [DateFilter - Admin].TimeTypeIn,
IIf(Sum(DateDiff("s",[clockin],[clockout]))-40*60*60>0,Sum(DateDiff("s",[cl*ockin],[clockout]))-40*60*60,0)

AS Overtime, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1 AS
WeekOf
FROM [DateFilter - Admin]
GROUP BY [DateFilter - Admin].Employee, [DateFilter -
Admin].TimeTypeIn, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1

HAVING ((([DateFilter - Admin].TimeTypeIn)="Regular"));

Bob, last posted "I cannot see why that sql is returning two records,
unless data
in one of the group by fields is not identical."

I think the line "DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS
WeekOf " of my query may be causing the problem. These field does not
produce identical records.

By keeping this in there, does anyone have suggestions on how to make
this so I don't have multiple records?

Thank you!

Brad

If I were in your situation, I might first create a new SELECT query
that simply pulls in the detail info.

SELECT Employee, TimeTypeIn,
[clockin],[clockout],DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS WeekOf
FROM [DateFilter - Admin]
Where ((([DateFilter - Admin].TimeTypeIn)="Regular"));

I don't know if it's possibe for you to do a calc on clock-in/out here.
ANyway, save the query as query 1.

Now create query 2. Use Query1 as the table. Do your summing and
grouping in this query.

I'd sooner have 2 queries that I can follow easily than 1 query that I
bust my ass over it.


Jun 20 '06 #3
Are you trying to keep that time in a Date/Time Field or Variable? Those are
for identifying a point in time, that is, a Date and Time of Day. If you
want to do calculations on time, you'll need to convert to the smallest unit
of interest, calculate, and then separate the larger units -- in Numeric
Fields, not Date/Time Fields.

Larry Linson
Microsoft Access MVP
"Drum2001" <dr******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Thank you for the suggestion!

When I do that, it does not subtract the "regular time".

For example:

Total Hours = 85:35:55
Overtime = 45:35:55

So it is not subtracting the "40:00:00"

Any suggestions why?



salad wrote:
Drum2001 wrote:
My question is in reference to the following closed thread.

http://groups.google.com/group/comp....29479ec733This
is my current query:

This is my current query:

SELECT [DateFilter - Admin].Employee, [DateFilter - Admin].TimeTypeIn,
IIf(Sum(DateDiff("s",[clockin],[clockout]))-40*60*60>0,Sum(DateDiff("s",[cl*ockin],[clockout]))-40*60*60,0)

AS Overtime, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1 AS
WeekOf
FROM [DateFilter - Admin]
GROUP BY [DateFilter - Admin].Employee, [DateFilter -
Admin].TimeTypeIn, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1

HAVING ((([DateFilter - Admin].TimeTypeIn)="Regular"));

Bob, last posted "I cannot see why that sql is returning two records,
unless data
in one of the group by fields is not identical."

I think the line "DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS
WeekOf " of my query may be causing the problem. These field does not
produce identical records.

By keeping this in there, does anyone have suggestions on how to make
this so I don't have multiple records?

Thank you!

Brad

If I were in your situation, I might first create a new SELECT query
that simply pulls in the detail info.

SELECT Employee, TimeTypeIn,
[clockin],[clockout],DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS WeekOf
FROM [DateFilter - Admin]
Where ((([DateFilter - Admin].TimeTypeIn)="Regular"));

I don't know if it's possibe for you to do a calc on clock-in/out here.
ANyway, save the query as query 1.

Now create query 2. Use Query1 as the table. Do your summing and
grouping in this query.

I'd sooner have 2 queries that I can follow easily than 1 query that I
bust my ass over it.

Jun 21 '06 #4
Larry,

Thank you for the response.

I actually have a function "sec2dur" that converts all the date/times
to numeric fields:

sec2dur()
//
Public Function SectoDur(seconds As Long) As String
On Error Resume Next
Dim hrs As Long
Dim Mins As Integer
Dim secs As Integer
hrs = Int(seconds / 3600)
Mins = Int((seconds - (3600 * hrs)) / 60)
secs = seconds - (hrs * 3600 + Mins * 60)
SectoDur = Format(hrs, "#,##0") _
& ":" & Format(Mins, "00") & ":" _
& Format(secs, "00")
//

If I do not "Filter" the results, the overtime is displayed correctly,
however, in to separate rows.

Larry Linson wrote:
Are you trying to keep that time in a Date/Time Field or Variable? Those are
for identifying a point in time, that is, a Date and Time of Day. If you
want to do calculations on time, you'll need to convert to the smallest unit
of interest, calculate, and then separate the larger units -- in Numeric
Fields, not Date/Time Fields.

Larry Linson
Microsoft Access MVP
"Drum2001" <dr******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Thank you for the suggestion!

When I do that, it does not subtract the "regular time".

For example:

Total Hours = 85:35:55
Overtime = 45:35:55

So it is not subtracting the "40:00:00"

Any suggestions why?



salad wrote:
Drum2001 wrote:
My question is in reference to the following closed thread.

http://groups.google.com/group/comp....29479ec733This
is my current query:

This is my current query:

SELECT [DateFilter - Admin].Employee, [DateFilter - Admin].TimeTypeIn,
IIf(Sum(DateDiff("s",[clockin],[clockout]))-40*60*60>0,Sum(DateDiff("s",[cl*ockin],[clockout]))-40*60*60,0)

AS Overtime, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1 AS
WeekOf
FROM [DateFilter - Admin]
GROUP BY [DateFilter - Admin].Employee, [DateFilter -
Admin].TimeTypeIn, DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1

HAVING ((([DateFilter - Admin].TimeTypeIn)="Regular"));

Bob, last posted "I cannot see why that sql is returning two records,
unless data
in one of the group by fields is not identical."

I think the line "DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS
WeekOf " of my query may be causing the problem. These field does not
produce identical records.

By keeping this in there, does anyone have suggestions on how to make
this so I don't have multiple records?

Thank you!

Brad

If I were in your situation, I might first create a new SELECT query
that simply pulls in the detail info.

SELECT Employee, TimeTypeIn,
[clockin],[clockout],DateAdd("d",-Weekday([ClockInDate]),[ClockInDate])+1
AS WeekOf
FROM [DateFilter - Admin]
Where ((([DateFilter - Admin].TimeTypeIn)="Regular"));

I don't know if it's possibe for you to do a calc on clock-in/out here.
ANyway, save the query as query 1.

Now create query 2. Use Query1 as the table. Do your summing and
grouping in this query.

I'd sooner have 2 queries that I can follow easily than 1 query that I
bust my ass over it.


Jun 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Hall | last post by:
The records in my database are displayed in a form as follows: %> <form action="report-ammend1.42.asp" method="post"name="form"> <table border=1> <% x = 1
3
by: mark | last post by:
How do I get all fields on one page of a report? I have a report that has a column for each day of the week and 6 records for each day. I need each weekday's records returned on only one detail...
2
by: JC | last post by:
Hi, I have a database that imports 4 reports to my "data" table, each report has its own identifier. Then I have a table with Analysts with the report identifier that they are to be assigned to. ...
5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
7
by: itm | last post by:
I have a mail out to send to a group of owners with multiple accounts. I want to limit the number of accounts that print on the first page to 20. I want remaining accounts to print on a second...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
1
by: dfw1417 | last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.