Setting up AutoCorrect entries through coding in Access XP

  • Thread starter Thread starter Dennis Snelgrove
  • Start date Start date
D

Dennis Snelgrove

How do we reference the AutoCorrect object in Access XP? I've got a
front-end that I distribute to a number of PCs, and it would be much nicer
to be able to put code into the initialization routine that adds a number of
AutoCorrect shortcuts we use. Now I've got to go to each PC and manually add
any entries. The only AutoCorrect references I can see find are in Excel.
 
We have a similar problem. We have about 50 runtime installations and we
want to turn off the autocorrect using code.
Any ideas?
Paul Kreingold
 
Yes, instead of doing it at the system level, you can write code that loops
through all the forms and controls and then sets the Allow AutoCorrect to False.

That code could look something like:

Public Sub sSetAutoCorrectFalse()
'REQUIRES DAO Library be set in Tools:References
'Set the allowautocorrect property to false
'on all textbox and combobox controls on all forms
Dim dbAny As DAO.Database
Dim docAny As Document
Dim cntlAny As Control
Dim strFormName As String

Set dbAny = CurrentDb()

For Each docAny In dbAny.Containers("Forms").Documents

strFormName = docAny.Name
DoCmd.OpenForm strFormName, acDesign

For Each cntlAny In Forms(strFormName).Controls
Select Case cntlAny.ControlType
Case acTextBox, acComboBox
If cntlAny.AllowAutoCorrect = True Then
cntlAny.AllowAutoCorrect = False
End If
End Select
Next cntlAny

DoCmd.Close acForm, strFormName, acSavePrompt
Next docAny

End Sub
 
Back
Top