Spellcheck only current record

  • Follow


I am using the following AfterUpdate code when exiting a text box named 
Narrative:
Private Sub Narrative_AfterUpdate()
    For Each ctl In Me.Controls
        If ctl.Name = "Narrative" Then
            ctl.Enabled = True
        Else
            If ctl.ControlType = acTextBox Then ctl.Enabled = False
        End If
    Next ctl
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSelectRecord
    Me.Narrative.SetFocus
    DoCmd.RunCommand acCmdSpelling
    DoCmd.SetWarnings True
    
    For Each ctl In Me.Controls
        If ctl.ControlType = acTextBox Then ctl.Enabled = True
    Next ctl
End Sub

My problem is that some users are reporting that it occassionally checks 
other records in the table, not just the one being viewed.  I have the form 
opened as acFormAdd and the Cycle = Current Record.   Is there anything I can 
add that will force it to do only the record being added?
0
Reply Utf 1/13/2010 10:13:01 PM

Jay,

That is an issue, so I use the one below.  I added the line * If 
ctlSpell.BackColor = 15400959 Then* so that any box on a form I want spell 
checked I tint that color and it only checks that one.  Using a button, you 
can activate with...

Private Sub cmdSpellCheck_Click()
    Call Spell
End Sub

.... or on your case, on the After_Update event.


'***Start of Code
Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
' Enumerate Controls collection.
For Each ctlSpell In frm.Controls
   If TypeOf ctlSpell Is TextBox Then
        If ctlSpell.BackColor = 15400959 Then
         If Len(ctlSpell) > 0 Then
             With ctlSpell
             .SetFocus
             .SelStart = 0
             .SelLength = Len(ctlSpell)
             End With
             DoCmd.RunCommand acCmdSpelling
         End If
       End If
    End If
Next
DoCmd.SetWarnings True
End Function
'**End of Code

-- 
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors 
II

http://www.regina-whipp.com/index_files/TipList.htm

"Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message 
news:A520F7EF-EAEB-4B3C-9F62-1200BEF510D3@microsoft.com...
>I am using the following AfterUpdate code when exiting a text box named
> Narrative:
> Private Sub Narrative_AfterUpdate()
>    For Each ctl In Me.Controls
>        If ctl.Name = "Narrative" Then
>            ctl.Enabled = True
>        Else
>            If ctl.ControlType = acTextBox Then ctl.Enabled = False
>        End If
>    Next ctl
>    DoCmd.SetWarnings False
>    DoCmd.RunCommand acCmdSelectRecord
>    Me.Narrative.SetFocus
>    DoCmd.RunCommand acCmdSpelling
>    DoCmd.SetWarnings True
>
>    For Each ctl In Me.Controls
>        If ctl.ControlType = acTextBox Then ctl.Enabled = True
>    Next ctl
> End Sub
>
> My problem is that some users are reporting that it occassionally checks
> other records in the table, not just the one being viewed.  I have the 
> form
> opened as acFormAdd and the Cycle = Current Record.   Is there anything I 
> can
> add that will force it to do only the record being added? 


0
Reply Gina 1/14/2010 2:26:07 AM


Gina - Thanks.   But won't it then spellcheck that same field in each record 
or am I missing something?
What if I add something like:

Dim lngCurrentRecordID as Long
lngCurrentRecordID = Me!RecordID

If TypeOf ctlSpell Is TextBox and Me!RecordID = lngCurrentRecordID then

Would that keep it from spellchecking any record other than one currently 
being viewed?

Jay

"Gina Whipp" wrote:

> Jay,
> 
> That is an issue, so I use the one below.  I added the line * If 
> ctlSpell.BackColor = 15400959 Then* so that any box on a form I want spell 
> checked I tint that color and it only checks that one.  Using a button, you 
> can activate with...
> 
> Private Sub cmdSpellCheck_Click()
>     Call Spell
> End Sub
> 
> .... or on your case, on the After_Update event.
> 
> 
> '***Start of Code
> Public Function Spell()
> ' Arvin Meyer 9/17/1998
> ' Adapted from code by Terry Wickenden
> Dim ctlSpell As Control
> Dim frm As Form
> Set frm = Screen.ActiveForm
> DoCmd.SetWarnings False
> ' Enumerate Controls collection.
> For Each ctlSpell In frm.Controls
>    If TypeOf ctlSpell Is TextBox Then
>         If ctlSpell.BackColor = 15400959 Then
>          If Len(ctlSpell) > 0 Then
>              With ctlSpell
>              .SetFocus
>              .SelStart = 0
>              .SelLength = Len(ctlSpell)
>              End With
>              DoCmd.RunCommand acCmdSpelling
>          End If
>        End If
>     End If
> Next
> DoCmd.SetWarnings True
> End Function
> '**End of Code
> 
> -- 
> Gina Whipp
> 2010 Microsoft MVP (Access)
> 
> "I feel I have been denied critical, need to know, information!" - Tremors 
> II
> 
> http://www.regina-whipp.com/index_files/TipList.htm
> 
> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message 
> news:A520F7EF-EAEB-4B3C-9F62-1200BEF510D3@microsoft.com...
> >I am using the following AfterUpdate code when exiting a text box named
> > Narrative:
> > Private Sub Narrative_AfterUpdate()
> >    For Each ctl In Me.Controls
> >        If ctl.Name = "Narrative" Then
> >            ctl.Enabled = True
> >        Else
> >            If ctl.ControlType = acTextBox Then ctl.Enabled = False
> >        End If
> >    Next ctl
> >    DoCmd.SetWarnings False
> >    DoCmd.RunCommand acCmdSelectRecord
> >    Me.Narrative.SetFocus
> >    DoCmd.RunCommand acCmdSpelling
> >    DoCmd.SetWarnings True
> >
> >    For Each ctl In Me.Controls
> >        If ctl.ControlType = acTextBox Then ctl.Enabled = True
> >    Next ctl
> > End Sub
> >
> > My problem is that some users are reporting that it occassionally checks
> > other records in the table, not just the one being viewed.  I have the 
> > form
> > opened as acFormAdd and the Cycle = Current Record.   Is there anything I 
> > can
> > add that will force it to do only the record being added? 
> 
> 
> .
> 
0
Reply Utf 1/14/2010 3:46:01 AM

Jay,

It does not for me...  It only checks the current record.  Now I do use a 
button but on the After_Update event of the field should work.  And yes, 
mine is in a continuos form.  I just checked it to be sure and it stays on 
the current record only.  Remember you are only *toning* the field you want 
spell checked.

-- 
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors 
II

http://www.regina-whipp.com/index_files/TipList.htm

"Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message 
news:7C3B885D-29E8-40CD-9053-9D7AB7F3464F@microsoft.com...
> Gina - Thanks.   But won't it then spellcheck that same field in each 
> record
> or am I missing something?
> What if I add something like:
>
> Dim lngCurrentRecordID as Long
> lngCurrentRecordID = Me!RecordID
>
> If TypeOf ctlSpell Is TextBox and Me!RecordID = lngCurrentRecordID then
>
> Would that keep it from spellchecking any record other than one currently
> being viewed?
>
> Jay
>
> "Gina Whipp" wrote:
>
>> Jay,
>>
>> That is an issue, so I use the one below.  I added the line * If
>> ctlSpell.BackColor = 15400959 Then* so that any box on a form I want 
>> spell
>> checked I tint that color and it only checks that one.  Using a button, 
>> you
>> can activate with...
>>
>> Private Sub cmdSpellCheck_Click()
>>     Call Spell
>> End Sub
>>
>> .... or on your case, on the After_Update event.
>>
>>
>> '***Start of Code
>> Public Function Spell()
>> ' Arvin Meyer 9/17/1998
>> ' Adapted from code by Terry Wickenden
>> Dim ctlSpell As Control
>> Dim frm As Form
>> Set frm = Screen.ActiveForm
>> DoCmd.SetWarnings False
>> ' Enumerate Controls collection.
>> For Each ctlSpell In frm.Controls
>>    If TypeOf ctlSpell Is TextBox Then
>>         If ctlSpell.BackColor = 15400959 Then
>>          If Len(ctlSpell) > 0 Then
>>              With ctlSpell
>>              .SetFocus
>>              .SelStart = 0
>>              .SelLength = Len(ctlSpell)
>>              End With
>>              DoCmd.RunCommand acCmdSpelling
>>          End If
>>        End If
>>     End If
>> Next
>> DoCmd.SetWarnings True
>> End Function
>> '**End of Code
>>
>> -- 
>> Gina Whipp
>> 2010 Microsoft MVP (Access)
>>
>> "I feel I have been denied critical, need to know, information!" - 
>> Tremors
>> II
>>
>> http://www.regina-whipp.com/index_files/TipList.htm
>>
>> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message
>> news:A520F7EF-EAEB-4B3C-9F62-1200BEF510D3@microsoft.com...
>> >I am using the following AfterUpdate code when exiting a text box named
>> > Narrative:
>> > Private Sub Narrative_AfterUpdate()
>> >    For Each ctl In Me.Controls
>> >        If ctl.Name = "Narrative" Then
>> >            ctl.Enabled = True
>> >        Else
>> >            If ctl.ControlType = acTextBox Then ctl.Enabled = False
>> >        End If
>> >    Next ctl
>> >    DoCmd.SetWarnings False
>> >    DoCmd.RunCommand acCmdSelectRecord
>> >    Me.Narrative.SetFocus
>> >    DoCmd.RunCommand acCmdSpelling
>> >    DoCmd.SetWarnings True
>> >
>> >    For Each ctl In Me.Controls
>> >        If ctl.ControlType = acTextBox Then ctl.Enabled = True
>> >    Next ctl
>> > End Sub
>> >
>> > My problem is that some users are reporting that it occassionally 
>> > checks
>> > other records in the table, not just the one being viewed.  I have the
>> > form
>> > opened as acFormAdd and the Cycle = Current Record.   Is there anything 
>> > I
>> > can
>> > add that will force it to do only the record being added?
>>
>>
>> .
>> 


0
Reply Gina 1/14/2010 4:29:16 AM

Gina,
    Thanks - you have been great help and I really appeciate it!
Jay

"Gina Whipp" wrote:

> Jay,
> 
> It does not for me...  It only checks the current record.  Now I do use a 
> button but on the After_Update event of the field should work.  And yes, 
> mine is in a continuos form.  I just checked it to be sure and it stays on 
> the current record only.  Remember you are only *toning* the field you want 
> spell checked.
> 
> -- 
> Gina Whipp
> 2010 Microsoft MVP (Access)
> 
> "I feel I have been denied critical, need to know, information!" - Tremors 
> II
> 
> http://www.regina-whipp.com/index_files/TipList.htm
> 
> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message 
> news:7C3B885D-29E8-40CD-9053-9D7AB7F3464F@microsoft.com...
> > Gina - Thanks.   But won't it then spellcheck that same field in each 
> > record
> > or am I missing something?
> > What if I add something like:
> >
> > Dim lngCurrentRecordID as Long
> > lngCurrentRecordID = Me!RecordID
> >
> > If TypeOf ctlSpell Is TextBox and Me!RecordID = lngCurrentRecordID then
> >
> > Would that keep it from spellchecking any record other than one currently
> > being viewed?
> >
> > Jay
> >
> > "Gina Whipp" wrote:
> >
> >> Jay,
> >>
> >> That is an issue, so I use the one below.  I added the line * If
> >> ctlSpell.BackColor = 15400959 Then* so that any box on a form I want 
> >> spell
> >> checked I tint that color and it only checks that one.  Using a button, 
> >> you
> >> can activate with...
> >>
> >> Private Sub cmdSpellCheck_Click()
> >>     Call Spell
> >> End Sub
> >>
> >> .... or on your case, on the After_Update event.
> >>
> >>
> >> '***Start of Code
> >> Public Function Spell()
> >> ' Arvin Meyer 9/17/1998
> >> ' Adapted from code by Terry Wickenden
> >> Dim ctlSpell As Control
> >> Dim frm As Form
> >> Set frm = Screen.ActiveForm
> >> DoCmd.SetWarnings False
> >> ' Enumerate Controls collection.
> >> For Each ctlSpell In frm.Controls
> >>    If TypeOf ctlSpell Is TextBox Then
> >>         If ctlSpell.BackColor = 15400959 Then
> >>          If Len(ctlSpell) > 0 Then
> >>              With ctlSpell
> >>              .SetFocus
> >>              .SelStart = 0
> >>              .SelLength = Len(ctlSpell)
> >>              End With
> >>              DoCmd.RunCommand acCmdSpelling
> >>          End If
> >>        End If
> >>     End If
> >> Next
> >> DoCmd.SetWarnings True
> >> End Function
> >> '**End of Code
> >>
> >> -- 
> >> Gina Whipp
> >> 2010 Microsoft MVP (Access)
> >>
> >> "I feel I have been denied critical, need to know, information!" - 
> >> Tremors
> >> II
> >>
> >> http://www.regina-whipp.com/index_files/TipList.htm
> >>
> >> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message
> >> news:A520F7EF-EAEB-4B3C-9F62-1200BEF510D3@microsoft.com...
> >> >I am using the following AfterUpdate code when exiting a text box named
> >> > Narrative:
> >> > Private Sub Narrative_AfterUpdate()
> >> >    For Each ctl In Me.Controls
> >> >        If ctl.Name = "Narrative" Then
> >> >            ctl.Enabled = True
> >> >        Else
> >> >            If ctl.ControlType = acTextBox Then ctl.Enabled = False
> >> >        End If
> >> >    Next ctl
> >> >    DoCmd.SetWarnings False
> >> >    DoCmd.RunCommand acCmdSelectRecord
> >> >    Me.Narrative.SetFocus
> >> >    DoCmd.RunCommand acCmdSpelling
> >> >    DoCmd.SetWarnings True
> >> >
> >> >    For Each ctl In Me.Controls
> >> >        If ctl.ControlType = acTextBox Then ctl.Enabled = True
> >> >    Next ctl
> >> > End Sub
> >> >
> >> > My problem is that some users are reporting that it occassionally 
> >> > checks
> >> > other records in the table, not just the one being viewed.  I have the
> >> > form
> >> > opened as acFormAdd and the Cycle = Current Record.   Is there anything 
> >> > I
> >> > can
> >> > add that will force it to do only the record being added?
> >>
> >>
> >> .
> >> 
> 
> 
> .
> 
0
Reply Utf 1/14/2010 8:38:02 PM

Jay,

You're welcome!

-- 
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors 
II

http://www.regina-whipp.com/index_files/TipList.htm

"Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message 
news:286BE610-B9D8-4370-AD4A-ED0285F939AE@microsoft.com...
> Gina,
>    Thanks - you have been great help and I really appeciate it!
> Jay
>
> "Gina Whipp" wrote:
>
>> Jay,
>>
>> It does not for me...  It only checks the current record.  Now I do use a
>> button but on the After_Update event of the field should work.  And yes,
>> mine is in a continuos form.  I just checked it to be sure and it stays 
>> on
>> the current record only.  Remember you are only *toning* the field you 
>> want
>> spell checked.
>>
>> -- 
>> Gina Whipp
>> 2010 Microsoft MVP (Access)
>>
>> "I feel I have been denied critical, need to know, information!" - 
>> Tremors
>> II
>>
>> http://www.regina-whipp.com/index_files/TipList.htm
>>
>> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message
>> news:7C3B885D-29E8-40CD-9053-9D7AB7F3464F@microsoft.com...
>> > Gina - Thanks.   But won't it then spellcheck that same field in each
>> > record
>> > or am I missing something?
>> > What if I add something like:
>> >
>> > Dim lngCurrentRecordID as Long
>> > lngCurrentRecordID = Me!RecordID
>> >
>> > If TypeOf ctlSpell Is TextBox and Me!RecordID = lngCurrentRecordID then
>> >
>> > Would that keep it from spellchecking any record other than one 
>> > currently
>> > being viewed?
>> >
>> > Jay
>> >
>> > "Gina Whipp" wrote:
>> >
>> >> Jay,
>> >>
>> >> That is an issue, so I use the one below.  I added the line * If
>> >> ctlSpell.BackColor = 15400959 Then* so that any box on a form I want
>> >> spell
>> >> checked I tint that color and it only checks that one.  Using a 
>> >> button,
>> >> you
>> >> can activate with...
>> >>
>> >> Private Sub cmdSpellCheck_Click()
>> >>     Call Spell
>> >> End Sub
>> >>
>> >> .... or on your case, on the After_Update event.
>> >>
>> >>
>> >> '***Start of Code
>> >> Public Function Spell()
>> >> ' Arvin Meyer 9/17/1998
>> >> ' Adapted from code by Terry Wickenden
>> >> Dim ctlSpell As Control
>> >> Dim frm As Form
>> >> Set frm = Screen.ActiveForm
>> >> DoCmd.SetWarnings False
>> >> ' Enumerate Controls collection.
>> >> For Each ctlSpell In frm.Controls
>> >>    If TypeOf ctlSpell Is TextBox Then
>> >>         If ctlSpell.BackColor = 15400959 Then
>> >>          If Len(ctlSpell) > 0 Then
>> >>              With ctlSpell
>> >>              .SetFocus
>> >>              .SelStart = 0
>> >>              .SelLength = Len(ctlSpell)
>> >>              End With
>> >>              DoCmd.RunCommand acCmdSpelling
>> >>          End If
>> >>        End If
>> >>     End If
>> >> Next
>> >> DoCmd.SetWarnings True
>> >> End Function
>> >> '**End of Code
>> >>
>> >> -- 
>> >> Gina Whipp
>> >> 2010 Microsoft MVP (Access)
>> >>
>> >> "I feel I have been denied critical, need to know, information!" -
>> >> Tremors
>> >> II
>> >>
>> >> http://www.regina-whipp.com/index_files/TipList.htm
>> >>
>> >> "Jay Myhre" <JayMyhre@discussions.microsoft.com> wrote in message
>> >> news:A520F7EF-EAEB-4B3C-9F62-1200BEF510D3@microsoft.com...
>> >> >I am using the following AfterUpdate code when exiting a text box 
>> >> >named
>> >> > Narrative:
>> >> > Private Sub Narrative_AfterUpdate()
>> >> >    For Each ctl In Me.Controls
>> >> >        If ctl.Name = "Narrative" Then
>> >> >            ctl.Enabled = True
>> >> >        Else
>> >> >            If ctl.ControlType = acTextBox Then ctl.Enabled = False
>> >> >        End If
>> >> >    Next ctl
>> >> >    DoCmd.SetWarnings False
>> >> >    DoCmd.RunCommand acCmdSelectRecord
>> >> >    Me.Narrative.SetFocus
>> >> >    DoCmd.RunCommand acCmdSpelling
>> >> >    DoCmd.SetWarnings True
>> >> >
>> >> >    For Each ctl In Me.Controls
>> >> >        If ctl.ControlType = acTextBox Then ctl.Enabled = True
>> >> >    Next ctl
>> >> > End Sub
>> >> >
>> >> > My problem is that some users are reporting that it occassionally
>> >> > checks
>> >> > other records in the table, not just the one being viewed.  I have 
>> >> > the
>> >> > form
>> >> > opened as acFormAdd and the Cycle = Current Record.   Is there 
>> >> > anything
>> >> > I
>> >> > can
>> >> > add that will force it to do only the record being added?
>> >>
>> >>
>> >> .
>> >>
>>
>>
>> .
>> 


0
Reply Gina 1/14/2010 9:59:09 PM

5 Replies
162 Views

(page loaded in 0.238 seconds)

Similiar Articles:











7/12/2012 10:40:57 PM


Reply: