E
Edan Mimran via AccessMonster.com
i have a form that should add a note to a table for each Employee that was
marked.
The code look like this:
Dim I As Variant
DoCmd.GoToRecord , , acFirst
For I = 1 To Form.RecordsetClone.RecordCount
If [CheckWillPrint] = True Then
Call AddNoteToEmployee
[CheckWillPrint] = False
End If
If Me.Recordset.AbsolutePosition + 1 < Me.Recordset.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
Next I
Public Function AddNoteToEmployee()
'Add Note to Employee History
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Employyes-ExtraHours")
rst.AddNew
rst![ID] = Forms![Employees_MultiDeduct_Main]![ID]
rst![WorkDate] = Forms![Employees_MultiDeduct_Main]![Whatdate]
rst![WorkedWhere] = Forms![Employees_MultiDeduct_Main]!
[AdditionDescription]
rst![TotalHours] = Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![PricePerHour] = Forms![Employees_MultiDeduct_Main]![StartSalary1]
/ 40 * Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![HourlyPresantage] = "100"
rst![PricePerHourPaid] = Forms![Employees_MultiDeduct_Main]!
[StartSalary1] / 40 * Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![WasPaid] = False
rst![CreatedOn] = Now()
rst![CreatedBy] = CurrentUser()
rst.Update
rst.Close
dbs.Close
End Function
the problem is:
When i compile the Database to an MDE file, The form doesn't cycle all the
records! its check only the first one. But when i run the database as MDB -
its working fine.
can someone help me with this?
thanks.
marked.
The code look like this:
Dim I As Variant
DoCmd.GoToRecord , , acFirst
For I = 1 To Form.RecordsetClone.RecordCount
If [CheckWillPrint] = True Then
Call AddNoteToEmployee
[CheckWillPrint] = False
End If
If Me.Recordset.AbsolutePosition + 1 < Me.Recordset.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
Next I
Public Function AddNoteToEmployee()
'Add Note to Employee History
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Employyes-ExtraHours")
rst.AddNew
rst![ID] = Forms![Employees_MultiDeduct_Main]![ID]
rst![WorkDate] = Forms![Employees_MultiDeduct_Main]![Whatdate]
rst![WorkedWhere] = Forms![Employees_MultiDeduct_Main]!
[AdditionDescription]
rst![TotalHours] = Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![PricePerHour] = Forms![Employees_MultiDeduct_Main]![StartSalary1]
/ 40 * Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![HourlyPresantage] = "100"
rst![PricePerHourPaid] = Forms![Employees_MultiDeduct_Main]!
[StartSalary1] / 40 * Forms![Employees_MultiDeduct_Main]![TotalHours]
rst![WasPaid] = False
rst![CreatedOn] = Now()
rst![CreatedBy] = CurrentUser()
rst.Update
rst.Close
dbs.Close
End Function
the problem is:
When i compile the Database to an MDE file, The form doesn't cycle all the
records! its check only the first one. But when i run the database as MDB -
its working fine.
can someone help me with this?
thanks.