Problem DoCmd.GoToRecord with tabbed pages

R

ridders

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
 
T

Terry

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top