Spell Check Questions (1 Viewer)

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
Ok, I found this code on the internnet.

Private Sub CompanyName_AfterUpdate()
'If the textbox contains data run the
'Spell Checker after data is entered.
If Len(Me!CompanyName & "") > 0 Then
DoCmd.RunCommand acCmdSpelling
Else
Exit Sub
End If
End Sub


now... he're the rub,
it works great doing a spell check of the fields that I tab through, but on my main form it will try and spell check the WHOLE TABLE.

How do I customize this to keep the spell check only to the record I have selected and not try to spellcheck 5000 enteries?

I want to use this for people who are inputing data into new fields, or editing fields of records. I have another button set up elseware for a full check.
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
it could be something to do with the Cycle property. i think what you need to do is change the cycle property to Current Record for when you want to do your one-record spell-check and switch it back to All Records after you are finished
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
I changed the cycle property to current record and current page, it will finish the check of all the fields on all of the fields in the form. I just want them to check the field of the form selected, and that's it.
 

ghudson

Registered User.
Local time
Today, 03:47
Joined
Jun 8, 2002
Messages
6,194
Try setting the focus to the field you want checked for spelling before you call acCmdSpelling.
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
try ghudson's approach first and if that doesn't work then.....

....maybe try saving your form's record source to a string variable, set your form's record source to the empty string, move the focus (txtField1.SetFocus) to the the text box you want to perform the search on, perform the search. finally set your form's record source back before saving. not sure what the outcome may be though
 

ghudson

Registered User.
Local time
Today, 03:47
Joined
Jun 8, 2002
Messages
6,194
How would I do that?

Code:
Private Sub CompanyName_AfterUpdate()

'If the textbox contains data run the
'Spell Checker after data is entered.

If Len(Me!CompanyName & "") > 0 Then
[B]    Me.CompanyName.SetFocus[/B]
    DoCmd.RunCommand acCmdSpelling
Else
    Exit Sub
End If
 
End Sub
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
"sighs" still not working...

try this:


txtBox1.SetFocus
if Trim(txtBox1.value) <> "" and IsNull(txtBox1.value) = false then
txtBox1.selLength = Len(Trim(txtBox1.text))
' Then perform your search here.
end if

where txtBox1 is the name of the text box you want to perform the search on
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
nope.. as soon as I correct the field, it moves onto the next record.
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
So, How do I incorperate this:
Private Sub LimitedSpellCheckButton_Click()

With Me!ControlToBeChecked

Me!ControlToBeChecked.SetFocus

If Len(.Value) > 0 Then
DoCmd.SetWarnings False
.SelStart = 1
.SelLength = Len(.Value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If

End With




End Sub
Into what i'm trying to do?
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
look at your Edit and Spell Check options in Access. maybe you can specify it not to move. are all your controls bound or unbound objects?

what you could do is unbind it before the spell check, then rebind after? I'm referring to it's ControlSource property. but that would depend upon whether they are bound or unbound.

create an unbound text box, set the value of that text box to the value of the search string. use the code supplied by ghudson to perform your spell check, and return the corrected value back to that control.
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
OK, I did :

Private Sub CompanyName_AfterUpdate()
With Me!CompanyName
Me!CompanyName.SetFocus
If Len(.Value) > 0 Then
DoCmd.SetWarnings False
.SelStart = 1
.SelLength = Len(.Value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If
End With
End Sub


I'm gettng and error code saying the macro is not allowing the data to be saved...

any ideas?
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
The Macro of runction set to the beforeupdate or ValidationRule property for this field is preventing Construction Pipeline from saving this data in the field

* If this is a macro, open the macro in the Macro window and remove the action that forces a save (for example, GoToControl).
*If the macro includes a SetValue action, set the macro to the AfterUpdateproperty of the control instead.
*If this is a function, redefine the funtion in the Module Window.
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
OK, I did :

Private Sub CompanyName_AfterUpdate()
With Me!CompanyName
Me!CompanyName.SetFocus
If Len(.Value) > 0 Then
DoCmd.SetWarnings False
.SelStart = 1
.SelLength = Len(.Value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If
End With
End Sub


I'm gettng and error code saying the macro is not allowing the data to be saved...

any ideas?


I think it would be better you put that on the LostFocus event of CompanyName. Also ensure that on the form's Data property, the "Allow Additions" and "Allow Edit" properties are set to Yes
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
THAT WORKS! changed from update to Lost focus. It's working perfectly now!
 

vbaInet

AWF VIP
Local time
Today, 08:47
Joined
Jan 22, 2010
Messages
26,374
THAT WORKS! changed from update to Lost focus. It's working perfectly now!

You're welcome. As an idea, maybe you could create an checkbox on your form that asks if the user wants each data entry to be checked everytime. Then check against what value deciding whether or not to perform a check. Just an idea (and i suppose it depends on how you want it done too).
 

Officeboy

Registered User.
Local time
Today, 00:47
Joined
Nov 10, 2009
Messages
66
I want my users forced to check their spelling... they all Suck! MUhahahahah... i'm creating a call center database, so spelling is REALLY BAD around here.
 

Users who are viewing this thread

Top Bottom