code resets form to first record

emcf

Member
Local time
Today, 23:12
Joined
Nov 14, 2002
Messages
209
I have the following code atached to a check box on a form -

Private Sub Check63_Click()
If IsNull([MitigatingAction7]) Then
Me.Check63 = "No"
Else
If Me.Check63 = "yes" Then
Me.Check63 = "No"
Exit Sub
Else
If MsgBox("Is this action completed?", vbYesNo + vbQuestion, "Completed?") = vbYes Then
Me.Check63 = "Yes"
Else
Me.Check63 = "No"
End If
End If
End If
Me.Requery
End Sub

It does what I want it to do however once it has run the form defaults back to record number 1.......how do I stop it from doing this and keep the form displaying the record that was being worked on???
 
You should probably just use Refresh instead of Requery unless it's critical for you at the check63_Click event to have Access run through the whole underlying recordset to find any changed, added, or deleted records in addition to the one you're positioned on.

If you really need to Requery the recordset then I believe you'll have to put in search code after the Me.Requery to return to your record (although I could be wrong about that).

Regards,
John
 
Thanks John,

that's sorted it out!!:D
 

Users who are viewing this thread

Back
Top Bottom