UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> SetAllAutocorrectsOff    

This function loops through each control of each form in the current database and sets the controls' AllowAutocorrect property to False (default is True). This is useful if you do not wish any autocorrect functionality in any of your forms. The function can be easily enough adapted to take an exception list or to work on a form-specific basis rather than on the AllForms collection. Add error handling as required.

CODE

Public Function SetAllAutoCorrectsOff() As Boolean

 Dim frm As Form
 Dim ctl As Control
 Dim i As Integer

 'make sure all forms are closed
 If Forms.Count <> 0 Then
   For i = 0 To Forms.Count - 1
     DoCmd.Close acForm, Forms(i).Name, acSaveYes
   Next
 End If
 
 For i = 0 To CurrentProject.AllForms.Count - 1
 
   DoCmd.OpenForm CurrentProject.AllForms(i).Name, acDesign
   
   For Each ctl In Forms(CurrentProject.AllForms(i).Name).Controls
   
     'if it's a control or textbox set the autocorrect property to false
     If (ctl.ControlType = acTextBox) Or (ctl.ControlType = acComboBox) Then
       ctl.AllowAutoCorrect = False
     End If
   
   Next ctl
   
   DoCmd.Close acForm, CurrentProject.AllForms(i).Name, acSaveYes
 
 Next i
   
End Function


Creative Commons License
SetAllAutocorrectsOff by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 2,125 times.  This page was last modified 02:32, 21 May 2011 by Jack Leach.   Disclaimers