The the last parameter of "GoToRecord" is an Offset. Which means that it will move forward or backward from the current record. Apparently, fldEmployeeID is a number that is bigger than the number of records you can move.
Perhaps you could use the WhereCondition parameter of the "OpenForm". Something like:
DoCmd.OpenForm "frmPayEntryScreen", acNormal, , "fldEmployeeID = " & fldEmployeeID, , acNormal
Frankly you may be going overboard here. You seem to be using a Main form only to provide the button to duplicate the current row. Why don't you use the main form to allow the user to select an employee and use the subform to display only the hours for that employee.
In that situation all you really need to do is add the records then requery the subform like:
Me.SubFormControlName.Requery
Of course your subform will have to be sorted in the appropriate order so the new (blank) records will appear at the top. Alternatively, after you have inserted the blank rows, you could just set the filter on the subform like:
Me.SubformControlName.Form.Filter = "[Hours] is null"
Me.SubformControlName.Form.FilterOn = True
I think those statements will work. You may have to do some tweaking to get it right. Also you should probably provide a way to unset that filter so the user can toggle between seeing all records in the subform and seeing only those blank ones for data entry.
If your user really wants to see all of the hours for all of the employees, you could also provide an option that doesn't restrict the subform to a single employee. I think that simply means removing the Master/Child link fields on the subform and requerying it.
Just curious about your data structure too...
Why does tblHours include fldName? Can't you derive the name of the person by linking fldEmployeeID to tblEmployees (or whatever you call that table)? If the employee's name changes later do you want tblHours to keep a record of the name of the employee at the time the hours were recorded? If tblHours includes the name for displaying in this Datasheet View subform, just change the record source of the subform to a query that combines tblHours and tblEmployee. You'll have to be careful how you build that query so it will be an updatable recordset. But that can be done.
Also, when you INSERT to tblHours, why don't you include a date? It seems to me you would want a Unique index on fldEmployeeID+HoursPeriodDate in tblHours to prevent the user from recording duplicate hours for a particular employee and period combination. I realize that that code would be pretty involved. But your database should be responsible for the integrity of the data -- not the user.
Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org