Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chaging form field to autocomplete

Status
Not open for further replies.

blaine011

IS-IT--Management
Joined
Jul 4, 2003
Messages
95
Location
CA
I fixed the first of the 2 problems, from my previous post, but now I have my last problem still there.

I've got this one field on a form which links to a list of customers. The only way to get to a particular customer under this field is to go through each record using the arrows at the bottom, until you reach that customer.

How do I change the form so that I can type in the customers name and it will start to autocomplete it?

As it stands now, if you try to type in that field it says "This recordset is not updateable".
 
Go to form design view,

make sure your wizard is enabled (that little magic wand)
select a combo box and place it where you want to on the form. The wizard will start, and choose Find a record on my form based on the value selected. Choose what fields you want to list in the box, use the AutoNumberID and another field (client name or something).Finish the wizard the rest of the way.

Once complete, go to the AfterUpdate event procedure and add the following after the last line -
DoCmd.GoToControl "ClientNameField"
(or whatever field, make sure it is the same name as listed in the properties of that Text Box)

Should look like this...
******
Private Sub CliNameCombo_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ClientID] = " & CliNameCombo
Me.Bookmark = rs.Bookmark
DoCmd.GoToControl "ClientName"
Me!CliNameCombo.Value = Null
End Sub
*******

The null part empties out the Combo Box so that it doesnt get confused with a field record. When you start typing it will find the closest match, just hit Enter when it matches. You might have more than 1 "Steve" or "Stephen" so you have to type until it matches the V or P.

Also check that the properties (Data Tab) Limit to List is set to Yes.

Also check out my FAQ on adding custom Navigation Controls so you can get away from using those pesky little record buttons.
faq702-4655 (dont know how to hyperlink that)(search FAQs for that number should work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top