ssblue
asked on
spell check
is there a way to add spell check to your database, forms, etc...
Pressing F7 will spell check the current field if MS spell checker is loaded on the system. If not, then you need a 3rd part spell checker such as Total Access or ComponentOne.
Normally this is active when you press F7.
BTW I ran today into this code:
CODE TO CHECK THE SPELLING IN A SINGLE TEXT BOX ON A FORM
Whilst we would all appreciate if our users checked their spelling before saving a large memo or text field, expecting that your users will press the F7 key or use an Access menu to start the speller is highly unlikely. Also if the user does use the Access built in spell checker, this can start off a sequence where every record in the table is checked. To counter this, you can setup a button on your form that will invoke the spell checker for one field. To illustrate this, see the code below that spell checks a field called Assessment. In this example, the field is spell checked using VBA. Note that the RunCommand method is the spell checking component of this process.
With Me!Assessment
If Len(.value) > 0 Then
DoCmd.SetWarnings False
.SetFocus
.SelStart = 1
.SelLength = Len(.value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If
End With
From the news letter of http://www.vb123.com/
Nic;o)
BTW I ran today into this code:
CODE TO CHECK THE SPELLING IN A SINGLE TEXT BOX ON A FORM
Whilst we would all appreciate if our users checked their spelling before saving a large memo or text field, expecting that your users will press the F7 key or use an Access menu to start the speller is highly unlikely. Also if the user does use the Access built in spell checker, this can start off a sequence where every record in the table is checked. To counter this, you can setup a button on your form that will invoke the spell checker for one field. To illustrate this, see the code below that spell checks a field called Assessment. In this example, the field is spell checked using VBA. Note that the RunCommand method is the spell checking component of this process.
With Me!Assessment
If Len(.value) > 0 Then
DoCmd.SetWarnings False
.SetFocus
.SelStart = 1
.SelLength = Len(.value)
DoCmd.RunCommand acCmdSpelling
.SelLength = 0
DoCmd.SetWarnings True
End If
End With
From the news letter of http://www.vb123.com/
Nic;o)
Assign the following code to command0 button on your Form
Private Sub Command0_Click()
On Error GoTo Err_Spelling_Check_Click
Dim X As Object
[Item Description].SetFocus
Set X = CreateObject("Word.Applica tion")
X.Visible = False
X.Documents.Add
X.Selection.Text = [Item Description].Text
X.ActiveDocument.CheckSpel ling
[Item Description].Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh anges
X.Quit
Set X = Nothing
Exit_Spelling_Check_Click:
Exit Sub
Err_Spelling_Check_Click:
MsgBox Err.Description
Resume Exit_Spelling_Check_Click
End Sub
Jaffer
Private Sub Command0_Click()
On Error GoTo Err_Spelling_Check_Click
Dim X As Object
[Item Description].SetFocus
Set X = CreateObject("Word.Applica
X.Visible = False
X.Documents.Add
X.Selection.Text = [Item Description].Text
X.ActiveDocument.CheckSpel
[Item Description].Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh
X.Quit
Set X = Nothing
Exit_Spelling_Check_Click:
Exit Sub
Err_Spelling_Check_Click:
MsgBox Err.Description
Resume Exit_Spelling_Check_Click
End Sub
Jaffer
ASKER
i created a command button and pasted the below into the "on click" expression builder but when i click on the button i get a compile error on
wdDoNotSaveChanges
Private Sub Command123_Click()
On Error GoTo Err_Spelling_Check_Click
Dim X As Object
[Item Description].SetFocus
Set X = CreateObject("Word.Applica tion")
X.Visible = False
X.Documents.Add
X.Selection.Text = [Item Description].Text
X.ActiveDocument.CheckSpel ling
[Item Description].Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh anges
X.Quit
Set X = Nothing
Exit_Spelling_Check_Click:
Exit Sub
Err_Spelling_Check_Click:
MsgBox Err.Description
Resume Exit_Spelling_Check_Click
End Sub
wdDoNotSaveChanges
Private Sub Command123_Click()
On Error GoTo Err_Spelling_Check_Click
Dim X As Object
[Item Description].SetFocus
Set X = CreateObject("Word.Applica
X.Visible = False
X.Documents.Add
X.Selection.Text = [Item Description].Text
X.ActiveDocument.CheckSpel
[Item Description].Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh
X.Quit
Set X = Nothing
Exit_Spelling_Check_Click:
Exit Sub
Err_Spelling_Check_Click:
MsgBox Err.Description
Resume Exit_Spelling_Check_Click
End Sub
The field which the spell checker is checking is called [Item Description]
please change the code to your field name and try again.
Then make sure you have the follow Reference in your Code > Tools > References
Visual Basic for applications
Microsoft Access 9.0 object Library >> Or higher
OLE Automation
Microsoft ActiveX Data objects 2.1 Library
Please make sure the y are in the exact order as shown above.
jaffer
please change the code to your field name and try again.
Then make sure you have the follow Reference in your Code > Tools > References
Visual Basic for applications
Microsoft Access 9.0 object Library >> Or higher
OLE Automation
Microsoft ActiveX Data objects 2.1 Library
Please make sure the y are in the exact order as shown above.
jaffer
Hi ssblue
How is going with your project?
jaffer
How is going with your project?
jaffer
ASKER
well i am on to something else because i could not get this to work.
i seem to have everything and in the right order but no worky???
i seem to have everything and in the right order but no worky???
Sorry to hear, then it's perhaps best to ask CommunitySupport to PAQ this question and refund the points.
Just post a 0 points question at: https://www.experts-exchange.com/Community_Support/
with the link of this question asking to close it.
Nic;o)
Just post a 0 points question at: https://www.experts-exchange.com/Community_Support/
with the link of this question asking to close it.
Nic;o)
Nic
Can I try 1 more thing before closing
ssblue
If you wish, you can email me your ziped mdb, telling me where the problem is and I can have a look at it,
Its a sham that you/we surrender when something is working somewhere.
jaffer
Can I try 1 more thing before closing
ssblue
If you wish, you can email me your ziped mdb, telling me where the problem is and I can have a look at it,
Its a sham that you/we surrender when something is working somewhere.
jaffer
That's the spirit jaffer :-)
Nic;o)
Nic;o)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points and the grade
jaffer
jaffer
ASKER
thank you for the help!!!!!!!!!!!!
ASKER
oops
i can't get it to let me out of the field that it just checked????????
i can't get it to let me out of the field that it just checked????????
Can you post the code ?
Nic;o)
Nic;o)
ASKER
this is on the ON LOST FOCUS line: =SpellCheck([Parts])
....{Parts is the field name}
(should this go in an event???? or just on the line??????
this is the module:
Function SpellCheck(CheckWhat)
Dim X As Object
CheckWhat.SetFocus
Set X = CreateObject("Word.Applica tion")
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel ling
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh anges
X.Quit
Set X = Nothing
End Function
....{Parts is the field name}
(should this go in an event???? or just on the line??????
this is the module:
Function SpellCheck(CheckWhat)
Dim X As Object
CheckWhat.SetFocus
Set X = CreateObject("Word.Applica
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh
X.Quit
Set X = Nothing
End Function
Nic
I posted the code, and now I am checking it (again) against his DB.
ssblue
What do you mean?
It will take a while to get out of the field, depending on the the amount of text you have there, because it checks for spelling against your dictionary.
why don't you post whats in your Parts field here, and tell me in which Form it is.
jaffer
I posted the code, and now I am checking it (again) against his DB.
ssblue
What do you mean?
It will take a while to get out of the field, depending on the the amount of text you have there, because it checks for spelling against your dictionary.
why don't you post whats in your Parts field here, and tell me in which Form it is.
jaffer
It's the line:
CheckWhat.SetFocus
that will cause this.
When you use the code in the programming code of the field you can set the focus to the next field on the form.
Nic;o)
CheckWhat.SetFocus
that will cause this.
When you use the code in the programming code of the field you can set the focus to the next field on the form.
Nic;o)
ASKER
i just typed in some mis-spelled words like
this is a tesst to seee if this workks
it was in the parts field on the quality tab of the MainScreen
then after checking the spelling and making corrections i tried to tab out of the field and starts the spell check again.
this is a tesst to seee if this workks
it was in the parts field on the quality tab of the MainScreen
then after checking the spelling and making corrections i tried to tab out of the field and starts the spell check again.
ssblue,
I went through your 4 Forms, and didn't find Parts in any of them.
Are using another database?
and what do you exactly mean by:
"i can't get it to let me out of the field that it just checked"
jaffer
I went through your 4 Forms, and didn't find Parts in any of them.
Are using another database?
and what do you exactly mean by:
"i can't get it to let me out of the field that it just checked"
jaffer
Although it is working with me fine, but
Try this,
We will assign the next field where the TAB should go,
so in the module
v-----------v add this, and
Function SpellCheck(CheckWhat, FocusNext)
Dim X As Object
CheckWhat.SetFocus <-- It makes no difference whether this line is there or deleted
Set X = CreateObject("Word.Applica tion")
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel ling
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh anges
X.Quit
Set X = Nothing
FocusNext.SetFocus '<-- add this
End Function
in your Form (WeekendScheduling subform), On Lost Focus should be like this:
=SpellCheck([HouseKeeping] ,[3rdAdvis or])
Which means, after finishing checking the spelling of HouseKeeping, move to 3rdAdvisor.
jaffer
Try this,
We will assign the next field where the TAB should go,
so in the module
v-----------v add this, and
Function SpellCheck(CheckWhat, FocusNext)
Dim X As Object
CheckWhat.SetFocus <-- It makes no difference whether this line is there or deleted
Set X = CreateObject("Word.Applica
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh
X.Quit
Set X = Nothing
FocusNext.SetFocus '<-- add this
End Function
in your Form (WeekendScheduling subform), On Lost Focus should be like this:
=SpellCheck([HouseKeeping]
Which means, after finishing checking the spelling of HouseKeeping, move to 3rdAdvisor.
jaffer
ASKER
i can't change the the On Lost Focus to
=SpellCheck([Parts],[Weld] )
i keep getting ...function contains wrong number of arguments
=SpellCheck([Parts],[Weld]
i keep getting ...function contains wrong number of arguments
please do it in design view
ASKER
i am in design view - if i understand you correctly
you want me to go to the design view of the form
go the the line On Lost Focus
and type in, on that line =SpellCheck([Parts],[Weld] )
yes??????
you want me to go to the design view of the form
go the the line On Lost Focus
and type in, on that line =SpellCheck([Parts],[Weld]
yes??????
Yes you are right.
ssblue
why don't you zip your Complete mdb and email it to me,
as I told you, I don't have the Form you are talking about in the mdb you sent me..
The deal is, NO Fix = Point Refunded back to you.
jaffer
ssblue
why don't you zip your Complete mdb and email it to me,
as I told you, I don't have the Form you are talking about in the mdb you sent me..
The deal is, NO Fix = Point Refunded back to you.
jaffer
OK here we go,
Nic
Being a Genius, heads down to you.
CheckWhat.SetFocus WAS the problem in ssblue's mdb.
ssblue
1-
As advised by Nic, the above line should be taken away from the module, so the module should be;
Function SpellCheck(CheckWhat)
Dim X As Object
Set X = CreateObject("Word.Applica tion")
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel ling
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh anges
X.Quit
Set X = Nothing
End Function
2-
Your design makes the switchboard dominant, thus doesn't allow you to be in the design view of "Body Shop Advisor's Log" Form,
So I would recommend you go to the design of your Forms from the Database window.
3-
In the Forms, use
On Lost Focus, you can call the module like this:
=SpellCheck([Parts])
4-
In places where, On Got Focus is already occupied with [Event Procedure],
go to VB and use the following code:
[Dimensional] = SpellCheck([Dimensional])
anywhere in your code before the End Sub.
Thats it man, I hope it goes OK from here on.
Please test it asap, as I have to go to bed within 1 hour from now.
jaffer
Nic
Being a Genius, heads down to you.
CheckWhat.SetFocus WAS the problem in ssblue's mdb.
ssblue
1-
As advised by Nic, the above line should be taken away from the module, so the module should be;
Function SpellCheck(CheckWhat)
Dim X As Object
Set X = CreateObject("Word.Applica
X.Visible = False
X.Documents.Add
X.Selection.Text = CheckWhat.Text
X.ActiveDocument.CheckSpel
CheckWhat.Text = X.Selection.Text
X.ActiveDocument.Close savechanges:=wdDoNotSaveCh
X.Quit
Set X = Nothing
End Function
2-
Your design makes the switchboard dominant, thus doesn't allow you to be in the design view of "Body Shop Advisor's Log" Form,
So I would recommend you go to the design of your Forms from the Database window.
3-
In the Forms, use
On Lost Focus, you can call the module like this:
=SpellCheck([Parts])
4-
In places where, On Got Focus is already occupied with [Event Procedure],
go to VB and use the following code:
[Dimensional] = SpellCheck([Dimensional])
anywhere in your code before the End Sub.
Thats it man, I hope it goes OK from here on.
Please test it asap, as I have to go to bed within 1 hour from now.
jaffer
Thanks jaffer, it's just a kind of sixth sence you develop after having made the amount of error I did :-)
Nic;o)
Nic;o)
ASKER
my hat to both of you!!!!!!!!11
sorry such a late post but i had been up for about 28 hrs
but watch out i'm back on the key boards!!
thanks again,
ssblue
sorry such a late post but i had been up for about 28 hrs
but watch out i'm back on the key boards!!
thanks again,
ssblue
Hey I am glad its over
jaffer
jaffer
ASKER
thank you again
you are welcome
You didn't send me the example of your Sentence case question,
please do that, it is a learning process for me too.
thanks
jaffer
You didn't send me the example of your Sentence case question,
please do that, it is a learning process for me too.
thanks
jaffer
-Don