Hi happy programmers,
I'm trying to use gotfocus event of a text object to go through a record set find a record without calling itself in the middle of the gotfocus event procedure.
Private Sub Text78_GotFocus()
' Check if the control receives the focus for first time
If flgfocusfirst = True Then
' Set the recordset to the variable
Set rstsub = Me.Recordset
' Find the recordset in the datasheet subform and make it current.
If IsNull(Forms![frm training schedule]![frm training schedule calendar sub]!SchedID) Then
' Add a new record
MsgBox ("There are no more records"
Exit Sub
End If
' Find in the subform the current record
rstsub.FindFirst ("SchedID = " & Forms![frm training schedule]![frm training schedule calendar sub]!SchedID)
' If this record doesn't exist tell the user
'If rstsub.NoMatch Then
' MsgBox "This record doesn't exist"
'End If
End If
' Mark the control has been focused on already
flgfocusfirst = False
End Sub
The instruction rstsub.FindFirst calls the Gotfocus subroutine instead of continuing with the next line.
I've tried to disable the event but can't do while it has the focus.
Thanks for any help,
Vanleurth
I'm trying to use gotfocus event of a text object to go through a record set find a record without calling itself in the middle of the gotfocus event procedure.
Private Sub Text78_GotFocus()
' Check if the control receives the focus for first time
If flgfocusfirst = True Then
' Set the recordset to the variable
Set rstsub = Me.Recordset
' Find the recordset in the datasheet subform and make it current.
If IsNull(Forms![frm training schedule]![frm training schedule calendar sub]!SchedID) Then
' Add a new record
MsgBox ("There are no more records"
Exit Sub
End If
' Find in the subform the current record
rstsub.FindFirst ("SchedID = " & Forms![frm training schedule]![frm training schedule calendar sub]!SchedID)
' If this record doesn't exist tell the user
'If rstsub.NoMatch Then
' MsgBox "This record doesn't exist"
'End If
End If
' Mark the control has been focused on already
flgfocusfirst = False
End Sub
The instruction rstsub.FindFirst calls the Gotfocus subroutine instead of continuing with the next line.
I've tried to disable the event but can't do while it has the focus.
Thanks for any help,
Vanleurth