I am trying to use docmd.findrecord to move to a particular record in a sub form, but cannot get it to work.
I have a form 'Employees' and a datasheet subform containing salary levels. When the user moves to a different employee I want the subform focus to move to the first record where the salary > 0. This is (part of) my code
in the mainform's On Current event
dim rstc as recordset, firstpoint as Variant
Set Rstc = forms!mainfrm!subform.form.Recordsetclone
rstc.findfirst "Salary >0"
firstpoint = rstc!Points
set rstc = nothing
forms!mainfrm!subform.form!Points.setfocus
docmd.FindRecord firstpoint
When I run this I get "Runtime error 2162, A macro set to one of the current fields properties failed because of an error in a FindRecord Action Argument."
I have tried setting various arguments without any success I always get the same message.
I have used a similar method successfully in Access 97 but cannot get the above to work in Access2000.
Any help greatly appreciated.
Rich
Lead Developer
I have a form 'Employees' and a datasheet subform containing salary levels. When the user moves to a different employee I want the subform focus to move to the first record where the salary > 0. This is (part of) my code
in the mainform's On Current event
dim rstc as recordset, firstpoint as Variant
Set Rstc = forms!mainfrm!subform.form.Recordsetclone
rstc.findfirst "Salary >0"
firstpoint = rstc!Points
set rstc = nothing
forms!mainfrm!subform.form!Points.setfocus
docmd.FindRecord firstpoint
When I run this I get "Runtime error 2162, A macro set to one of the current fields properties failed because of an error in a FindRecord Action Argument."
I have tried setting various arguments without any success I always get the same message.
I have used a similar method successfully in Access 97 but cannot get the above to work in Access2000.
Any help greatly appreciated.
Rich
Lead Developer