Disabling Text Box AutoCorrect Via Code

B

Bob

We just switched from A2002 to A2003. I want to change the
autocorrect property of field text boxes to no with code. If anyone
has a sample to share, it would be appreciated.

Regards,
Bob
 
F

fredg

We just switched from A2002 to A2003. I want to change the
autocorrect property of field text boxes to no with code. If anyone
has a sample to share, it would be appreciated.

Regards,
Bob

I assume you mean the AllowAutoCorrect property of the text control.
For all forms in the database?
Copy and Paste the below procedure into a Module.
Run it.

Public Sub ChangeAllowAutoCorrect()

' Change the AllowAutoCorrect property of every text
' control on every form in the database to False

Dim db As DAO.Database, doc As DAO.Document, ctl As Control
Set db = CurrentDb
Dim prp As Property
On Error GoTo Err_Handler

For Each doc In db.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
For Each ctl In Forms(doc.Name)
If TypeOf ctl Is TextBox Then
ctl.Properties("AllowAutoCorrect").Value = False
End If
Next
DoCmd.Close acForm, doc.Name, acSaveYes
Next

Exit_Sub:
Set db = Nothing
Exit Sub
Err_Handler:
MsgBox "Error #: " & Err.Number & vbNewLine & Err.Description
Resume Exit_Sub

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top