Paul Cooke
Registered User.
- Local time
- Today, 00:43
- Joined
- Oct 12, 2001
- Messages
- 288
Whilst testing my DB I have stumbled across an issue that is confusing me !!
I have a Cbo for occupation - as it is not vital data the user can add to the list if a new occupation is required and not there.
The issue I have is that if someone puts in "painterr" the notinlist event will fire even though "Painter" (spealt correctly) is already in there - I do have a msgbox pop up to ask them to check the spelling and check the list for an occupation correctly spealt.
Is there a way I can run spellcheck on everything they put in the cbo before the notinlist event triggers as they may actually enter a occupation not already in the list, spealt incorrectly.
The code I have at the moment is
there are no other events being used on this control apart from notinlist
The code I use on other controls for spell check is
Thanks for any advice offered
Paul
I have a Cbo for occupation - as it is not vital data the user can add to the list if a new occupation is required and not there.
The issue I have is that if someone puts in "painterr" the notinlist event will fire even though "Painter" (spealt correctly) is already in there - I do have a msgbox pop up to ask them to check the spelling and check the list for an occupation correctly spealt.
Is there a way I can run spellcheck on everything they put in the cbo before the notinlist event triggers as they may actually enter a occupation not already in the list, spealt incorrectly.
The code I have at the moment is
Code:
Beep
intAnswer = MsgBox("The occupation " & Chr(34) & NewData & Chr(34) & " has not been stored in the database yet." & vbCrLf & vbCrLf & _
"Is the spelling correct?" & vbCrLf & vbCrLf & _
"Click Yes to add it to the list or No to choose a occupation from the current list.", vbQuestion + vbYesNo, "No Record Found")
If intAnswer = vbYes Then
strSql = "INSERT INTO PatientOccupations([PatientOccupation]) " & "VALUES ('" & StrConv(NewData, vbProperCase) & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
MsgBox "The new occupation has been added to the database.", vbInformation, "New Data Added"
Response = acDataErrAdded
Else
MsgBox "Please select an occupation from the list or re enter the original one correctly.", vbInformation, "New Data Not Added"
Me.cboPatientOccupation.Text = ""
Response = acDataErrContinue
End If
cboPatientOccupation_NotInList_Exit:
Exit Sub
cboPatientOccupation_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboPatientOccupation_NotInList_Exit
there are no other events being used on this control apart from notinlist
The code I use on other controls for spell check is
Code:
DoCmd.SetWarnings False
If Len(Me!CONTROLNAME & "") > 0 Then
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True
Else
Exit Sub
Thanks for any advice offered
Paul