Complete Filling a Text Field Automatically

K

Ken Curtis

Hi!
I have a form. There are text fields on it. One of the fields has only 6
options to complete it (Contact, Mail, General, All Staff, etc). I would
like the field to complete itself after I have entered the first letter of
one of the options (i.e. I enter the field, type "C", and it completes the
word "Contact" ... and I tab out).

Thoughts?
 
J

Jason

I use combo boxes. You can click on the down arrow and select the text you
want. One of the effects when typing is that it autocompletes.
 
L

Linq Adams via AccessMonster.com

Jason's suggestion is valid, of course, and would certainly be the only way
to go with a larger, extended list, but if you only have 6 options and they
all start with a different letter, this will do

Private Sub TextBox_Change()
Select Case Left(TextBox.Text, 1)
Case "c"
Me.TextBox = "Contact"
Case "m"
Me.TextBox = "Mail"
Case "a"
Me.TextBox = "All Staff"
End Select
End Sub
 
L

Linq Adams via AccessMonster.com

Sorry, meant to add a "Case Else" in case the useer has a brain fart and
tries to enter something not in the list. With this modification enetering an
incorrect first letter will blank out the field.

Private Sub TextBox_Change()
Select Case Left(TextBox.Text, 1)
Case "c"
Me.TextBox = "Contact"
Case "m"
Me.TextBox = "Mail"
Case "a"
Me.TextBox = "All Staff"
Case Else
Me.TextBox = ""
End Select
End Sub
 
Top