Problem DoCmd.GoToRecord with tabbed pages

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
It seems to me that you are re-inventing the wheel. The Spelling option
already does what you are trying to do. If the user clicks in the field &
presses F7 the spell checker checks this field for all records. Forgive me
please if I am mistaken but isn't that what you are trying to do?

PS: Instead of working on the Recordset of a form work on the
RecordsetClone. This avoids screen displays of each record and having to
remember where you are.
HTH
Terry
 
Back
Top