Move after Enter on last record of continuous form (1 Viewer)

mitre5

New member
Local time
Today, 07:40
Joined
Sep 14, 2011
Messages
3
Hi
FIRST POST!
I've been working on a mainform / continuous subform all this week and finally have everything working as i want except ...
This form is for the entry of assessment results for classes of students. The continuous subform lists the student name, a tick box to indicate absence, a field call RawMark for the user to enter the (numeric) test score, the maximum marks possible and a calculated field to show the percentage. I've got it working so the user simply enters the score in each rawmark field, presses enter and the cursor moves to the RawMark field on the next record. When this happens the percentage is calculated and displayed. But on the last record, after entering the score and pressing enter the cursor stays where it is and the percentage is not calculated or displayed.

the method i'm using to move the cursor to next record is:

In the subform OnLoad event i have:
Private Sub Form_Load()
Me.KeyPreview = True
End Sub

In the subform KeyUp event I have:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
KeyCode = 0
Application.SetOption "move after enter", 2
End If
End Sub

Because I've prevented new records being created (all records are created before the subform is opened) there's nowhere for the Enter Key to go on the last record.
Can anyone advise what Event on the [RawMark] field would be best to use to detect that a figure has been entered in the field and thus calculate the percentage? I've tried a few and none of them works quite right.

By the way, the problem only arises if this is the first time the user enters scores. If they revisit the form and change the score in the last record, the percentage is updated properly.

Sorry for the long description. I figured more information is better than less.
 

Mihail

Registered User.
Local time
Today, 09:40
Joined
Jan 22, 2011
Messages
2,373
Try the Requery command.
Me.Requery

or

SubformName.Requery
 

mitre5

New member
Local time
Today, 07:40
Joined
Sep 14, 2011
Messages
3
thanks for the suggestion. Unfortunately that makes no difference. :confused:
I've added that to the OnKeyDown event with a test for the Enter key but it doesn't fire. If I use the tab key it works.
 

Users who are viewing this thread

Top Bottom