Here's a suggestion:
I just created a Payroll database and I didn't want the users to enter dates
either. I have a form that allows the user to choose the employee (combo box)
and the work week -- I added a combo box showing the ending pay period and then
have a calculated textbox for the beginning pay period (= EndDate_Combo - 6).
Then this code adds 7 records, if needed:
'check to see how many records for this employee for the work week
Dim CkRecordCount
CkRecordCount = DCount("[EmpID] & [WorkDate]", "tblHoursWorked", _
"[EmpID] = '" & Me.Employee_combo & "'" & _
" AND [WorkDate] between #" & Me.txtBeginDate & "# and #" &
Me.EndDate_Combo & "#")
Dim dt As Date, CkWorkDate
If CkRecordCount 7 Then
'to make sure there are 7 days displayed for the work week
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = DBEngine(0)(0)
Set rs = db.OpenRecordset("tblHoursWorked", dbOpenDynaset, dbAppendOnly)
For dt = Me.txtBeginDate To Me.txtBeginDate + 6
CkWorkDate = DLookup("[EmpNo] & [WorkDate]", "tblHoursWorked", _
"[EmpNo] = '" & Me.Employee_combo & "'" & _
" AND [WorkDate] = #" & dt & "#")
If IsNull(CkWorkDate) Then
With rs
.AddNew
!EmpNo= Me.Employee_combo
!WorkDate = dt
.Update
End With
End If
Next
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End If
Then in Form_Close, I run a delete query on tblHoursWorked if all fields are
empty except EmpNo and Workdate so I don't have useless records in my table.
".::Kay-Dija::." wrote in message
...
| The reason I had the information pre-entered is because I did not want the
| user have to enter information for each employee everyday... I was trying to
| make her job easier. I figured that if the information was pre entered, all
| she would have to do is edit the records whose information needed changing.
|
| Maybe it is the wrong way to go about doing it... But if you have any other
| suggestion or a better way of doing it... Let me know
|