randerson07
New member
- Local time
- Today, 01:40
- Joined
- Dec 19, 2009
- Messages
- 1
First off, this is my first post. Ive only been using Access for a month or two and this forum has helped quite a bit. With all your help I was able to create a useful cost capture and reporting tool for my company, many thanks.
Now to my questions.
My company is about to open a second location and we want to stop using paper time cards to make it easier on everyone. So far Ive been able to sort of get the "Clock In" function to work. With one exception when I click my command button my code enters my data twice(2 records with the same data). What would cause that?
Here is my on click code
Private Sub ClockIn_Click()
Dim sSQL
sSQL = "INSERT INTO hoursentry ([employeeID],[workdate],[starttime]) VALUES ('" & Me.EmployeeID & "' ,'" & Me.WorkDate & "', '" & Me.StartTime & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
DoCmd.Close
End Sub
It does what I want only it does it twice.
Question two, The clock out function has me confused. The way I pictured it, I use a main form with two buttons, one opens a "clock in" form where you enter your emp ID via a scanner(ill be creating barcoded ID badges) then click a "clock in" button which inserts the date, starttime and emp id into a table and closes the form. The second button from the main form would open a "clock out" form. But I cant seem to figure out how to navigate back to the original record with just one input, that input being the emp ID again. Any hints on how to go about this?
I attached my sample DB, hopefully thats more helpful that me trying to explain it. If you want to try it, here are some random Emp IDs that Access created for me
EmployeeID
-611991064
743524579
849593581
1677101994
Id like to just be given some hints as to what type of direction to take for this, its been fun toying with Access these last few months. Ive done more with it than I have actual work.
Im not sure if Im asking too much here, but if I am please tell me. This might just be beyond what Im capable of and if thats the case, so be it, paper time cards wont kill us.
Thanks In advance.
Ryan
Now to my questions.
My company is about to open a second location and we want to stop using paper time cards to make it easier on everyone. So far Ive been able to sort of get the "Clock In" function to work. With one exception when I click my command button my code enters my data twice(2 records with the same data). What would cause that?
Here is my on click code
Private Sub ClockIn_Click()
Dim sSQL
sSQL = "INSERT INTO hoursentry ([employeeID],[workdate],[starttime]) VALUES ('" & Me.EmployeeID & "' ,'" & Me.WorkDate & "', '" & Me.StartTime & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
DoCmd.Close
End Sub
It does what I want only it does it twice.
Question two, The clock out function has me confused. The way I pictured it, I use a main form with two buttons, one opens a "clock in" form where you enter your emp ID via a scanner(ill be creating barcoded ID badges) then click a "clock in" button which inserts the date, starttime and emp id into a table and closes the form. The second button from the main form would open a "clock out" form. But I cant seem to figure out how to navigate back to the original record with just one input, that input being the emp ID again. Any hints on how to go about this?
I attached my sample DB, hopefully thats more helpful that me trying to explain it. If you want to try it, here are some random Emp IDs that Access created for me
EmployeeID
-611991064
743524579
849593581
1677101994
Id like to just be given some hints as to what type of direction to take for this, its been fun toying with Access these last few months. Ive done more with it than I have actual work.
Im not sure if Im asking too much here, but if I am please tell me. This might just be beyond what Im capable of and if thats the case, so be it, paper time cards wont kill us.
Thanks In advance.
Ryan