Change Record value to another field (1 Viewer)

JPaulo

Developer
Local time
Today, 21:28
Joined
Dec 21, 2009
Messages
185
Hi all;

I have a table with 2000 records.
I need to put the last hour of the day and employee for the field EndTime.
It is possible for vba cod?

Look at the picture in attached, please.
 

Attachments

  • 16-12-2010 12-08-11.jpg
    16-12-2010 12-08-11.jpg
    14.6 KB · Views: 54

JPaulo

Developer
Local time
Today, 21:28
Joined
Dec 21, 2009
Messages
185
Thanks for responding VbaInet.

Friend, in field exist the one time lower and one higher
which corresponds to the entry and departure from the employee, I need to separate by date and employee
and insert in another table (for example).
 

vbaInet

AWF VIP
Local time
Today, 21:28
Joined
Jan 22, 2010
Messages
26,374
So an employee does not clock in more than once in a day? And it can never happen?
 

JPaulo

Developer
Local time
Today, 21:28
Joined
Dec 21, 2009
Messages
185
Yes VbaInet , never.
Only has one input and one output.
 

vbaInet

AWF VIP
Local time
Today, 21:28
Joined
Jan 22, 2010
Messages
26,374
Okay, it shouldn't be too hard. Here are the steps:

1. Add the three fields to your query.
2. The alias for EndTime will be:
Code:
EndTime: (SELECT Q.StartTime FROM TableName WHERE Q.EmployeeID = TableName.EmployeeID AND Q.[Date] = TableName.[Date] AND Q.StartTime > TableName.StartTime)
3. Finally, put NOT IS NULL under this alias, EndTime criteria.

NB: Change TableName to be the table you're using. Remember you shouldn't be using Date as a field name because it is a reserved keyword. If you continue like this you must enclose Date in square brackets (like I've done).
 

JPaulo

Developer
Local time
Today, 21:28
Joined
Dec 21, 2009
Messages
185
Perfect, worked a charm

The word Date and Time are not being used, just in example.

Thanks and Merry Christmas
 

Users who are viewing this thread

Top Bottom