Solved

Access DLookup next record

Posted on 2013-05-21
6
1,028 Views
Last Modified: 2013-05-23
Using Microsoft Access, I am trying to associate the punch out time with the punch in record.  See attached spreadsheet, column I is what I am trying to calculate.

Over the group of employees with the same employee number, each record has a sequential id that puts them in order.  I want to be able to take the next record punch time and associate it with the current record and call it the "punch out" time.  While processing the current record, if the previous record had a "punch out" time calculated, then don't calculate one for the current record.

Best to look at attached file, column I for what I need done.
clockexample.xls
0
Comment
Question by:ndornack
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:als315
ID: 39186563
If you have no multiple in-outs during day, you can take min and max time. Look at sample
DBInOut.accdb
0
 

Author Comment

by:ndornack
ID: 39187382
The problem with this solution is when an employee starts on one day and ends on the next.  Ie.
start 05/14/2013 at 2:30pm
end 05/15/2013 at 12:02 am

see attached file with example data added.
DBInOut.accdb
0
 
LVL 39

Expert Comment

by:als315
ID: 39188011
Look at qrySeq in sample
DBInOut.accdb
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ndornack
ID: 39190731
I am trying this and getting the error:

Data type mismatch in criteria expression

for the query "qryInOutFinal"

What is wrong?
InOut.mdb
0
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 39192007
In your DB Employee Number is text, so in criretia you should add quotes around it:
"[EmpNum] = " & Chr(34) & [qryInOut00].[EmpNum] & Chr(34) & ....
InOut.mdb
0
 

Author Comment

by:ndornack
ID: 39192240
als315 - Works perfect, thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now