Solved

Access DLookup next record

Posted on 2013-05-21
6
1,113 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 40

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 40

Expert Comment

by:als315
ID: 39188011
Look at qrySeq in sample
DBInOut.accdb
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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 40

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

623 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