G
Guest
I have a number of similar forms on each of which I've added a SpellCheck
control. These check all records and then return to 'current' record.
The current record number is stored using an unbound control txtRecordCheck
The code works fine on non-tabbed forms:
--------------------------------------------
Private Sub btnSpellCheck_Click()
On Error GoTo Err_btnSpellCheck_Click
'Store current record number
txtRecordCheck = Me.Recordcounter
'Run Spellcheck
DoCmd.GoToRecord , , acFirst
SendKeys "{F7}", 1
'Stop screen updating until view returns to original record
DoCmd.Echo False
DoCmd.GoToRecord , , acFirst
If Me.txtRecordCheck = Me.TotalRecords Then
DoCmd.GoToRecord , , acLast
RecordNumber = Me.TotalRecords
Else
If Me.txtRecordCheck > 1 Then
DoCmd.GoToRecord , , acNext, Me.txtRecordCheck
DoCmd.GoToRecord , , acPrevious
RecordNumber = Me.txtRecordCheck
End If
End If
Me.Recordcounter = RecordNumber
DoCmd.GoToControl "Report"
DoCmd.Echo True
Exit_btnSpellCheck_Click:
Exit Sub
Err_btnSpellCheck_Click:
MsgBox err.Description
Resume Exit_btnSpellCheck_Click
End Sub
----------------------------------------------------------
However it fails on tabbed forms unless the current record = record1.
Either the form closes or I get a message stating that I can't go to the
specified record. Please can anyone tell me how to get the idea to work for
tabbed forms
Thanks
control. These check all records and then return to 'current' record.
The current record number is stored using an unbound control txtRecordCheck
The code works fine on non-tabbed forms:
--------------------------------------------
Private Sub btnSpellCheck_Click()
On Error GoTo Err_btnSpellCheck_Click
'Store current record number
txtRecordCheck = Me.Recordcounter
'Run Spellcheck
DoCmd.GoToRecord , , acFirst
SendKeys "{F7}", 1
'Stop screen updating until view returns to original record
DoCmd.Echo False
DoCmd.GoToRecord , , acFirst
If Me.txtRecordCheck = Me.TotalRecords Then
DoCmd.GoToRecord , , acLast
RecordNumber = Me.TotalRecords
Else
If Me.txtRecordCheck > 1 Then
DoCmd.GoToRecord , , acNext, Me.txtRecordCheck
DoCmd.GoToRecord , , acPrevious
RecordNumber = Me.txtRecordCheck
End If
End If
Me.Recordcounter = RecordNumber
DoCmd.GoToControl "Report"
DoCmd.Echo True
Exit_btnSpellCheck_Click:
Exit Sub
Err_btnSpellCheck_Click:
MsgBox err.Description
Resume Exit_btnSpellCheck_Click
End Sub
----------------------------------------------------------
However it fails on tabbed forms unless the current record = record1.
Either the form closes or I get a message stating that I can't go to the
specified record. Please can anyone tell me how to get the idea to work for
tabbed forms
Thanks