didacticone
New member
- Local time
- Today, 16:46
- Joined
- Apr 10, 2018
- Messages
- 9
Hey!
So I have a created a timesheet database. It has a main form where an employee can sign in and out with a seperate button for each. When sign out is clicked it asks if the employee has worked a full day. If they click no it pops up a form bound to the same table as my main form (tbl_master) and asks which type of half day the employee is taking (vacation, sick, personal). It then adds the type of day to the employees record for that day. All of this is working great. The problem I am having is, I have a seperate table called "tbl_daysoff" which consists of 4 records (each employees name, and how many of each day off they have left, as a numeric value). I am currently using the following code to try to subtract from the numeric field and it is working but only on the first employee. It is not changing the value based on the current employee and I cannot seem to figure it out.. here is my code:
The form that opens when you click no for the question if you worked a full day is called "frm_typeofdayoff" and when that form opens it pulls the current record from the main form. I hope I gave enough detail... if not let me know and I will try to explain better. Thanks!
So I have a created a timesheet database. It has a main form where an employee can sign in and out with a seperate button for each. When sign out is clicked it asks if the employee has worked a full day. If they click no it pops up a form bound to the same table as my main form (tbl_master) and asks which type of half day the employee is taking (vacation, sick, personal). It then adds the type of day to the employees record for that day. All of this is working great. The problem I am having is, I have a seperate table called "tbl_daysoff" which consists of 4 records (each employees name, and how many of each day off they have left, as a numeric value). I am currently using the following code to try to subtract from the numeric field and it is working but only on the first employee. It is not changing the value based on the current employee and I cannot seem to figure it out.. here is my code:
Code:
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set MyDB = CurrentDb
strSQL = "SELECT * FROM tbl_daysoff"
Set rst = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
With rst
.Edit
![vacation] = ![vacation] - 0.5
.Update
End With
rst.Close
Set rst = Nothing
The form that opens when you click no for the question if you worked a full day is called "frm_typeofdayoff" and when that form opens it pulls the current record from the main form. I hope I gave enough detail... if not let me know and I will try to explain better. Thanks!