Hello all,
I am attempting to add a spell checker code which was taken from the forum to my existing VBA form that was completed for me but I am a little stuck.
Below is the code that was written for me.
What I added is a different color.
Is there a way that when I click the save comment it will then initiate the spell check, and after its complete it saves the comment, or is it better to have a button on my form labelled "Spell Check"
Option Compare Database
Option Explicit
Private Sub cmdCancel_Click()
'close without saving
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdSave_Click()
If Nz(Me.Comments, "") = "" Then
MsgBox "You have not entered a comment", vbCritical, "Nothing to save"
Me.Comments.SetFocus
Exit Sub
End If
'append new comment to tblMemoFieldVH
CurrentDb.Execute "INSERT INTO tblMemoFieldVH (IssuesID, MemoField, MemoFieldDateTime)" & _
" VALUES (" & Me.ID & ", '" & Me.Comments & "', #" & Format(Now(), "mm/dd/yyyy hh:nn:ss") & "#);"
DoCmd.Close acForm, Me.Name
'refresh comments subform
Forms!frmUpdateForm.fsubMemoFieldVH.Form.Requery
End Sub
Private Sub Form_frmNewComment_Exit(Cancel As Integer)
Dim strSpell
strSpell = frmNewcomment
If IsNull(Len(strSpell)) Or Len(strSpell) = 0 Then
Exit Sub
End If
With frmNewcomment
.SetFocus
.SelStart = 0
.SelLength = Len(strSpell)
End With
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
End Sub
Private Sub Form_Load()
'Use ID from main form
Me.ID = Forms!frmUpdateForm.ID
End Sub
I am attempting to add a spell checker code which was taken from the forum to my existing VBA form that was completed for me but I am a little stuck.
Below is the code that was written for me.
What I added is a different color.
Is there a way that when I click the save comment it will then initiate the spell check, and after its complete it saves the comment, or is it better to have a button on my form labelled "Spell Check"
Option Compare Database
Option Explicit
Private Sub cmdCancel_Click()
'close without saving
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdSave_Click()
If Nz(Me.Comments, "") = "" Then
MsgBox "You have not entered a comment", vbCritical, "Nothing to save"
Me.Comments.SetFocus
Exit Sub
End If
'append new comment to tblMemoFieldVH
CurrentDb.Execute "INSERT INTO tblMemoFieldVH (IssuesID, MemoField, MemoFieldDateTime)" & _
" VALUES (" & Me.ID & ", '" & Me.Comments & "', #" & Format(Now(), "mm/dd/yyyy hh:nn:ss") & "#);"
DoCmd.Close acForm, Me.Name
'refresh comments subform
Forms!frmUpdateForm.fsubMemoFieldVH.Form.Requery
End Sub
Private Sub Form_frmNewComment_Exit(Cancel As Integer)
Dim strSpell
strSpell = frmNewcomment
If IsNull(Len(strSpell)) Or Len(strSpell) = 0 Then
Exit Sub
End If
With frmNewcomment
.SetFocus
.SelStart = 0
.SelLength = Len(strSpell)
End With
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
End Sub
Private Sub Form_Load()
'Use ID from main form
Me.ID = Forms!frmUpdateForm.ID
End Sub