Full Version: Auto-Complete Form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Legend
Should be fairly simple, but I'm having a [censored] of a time.

Have a form with contact information - first name, last name, address, city, state, zip, telephone. - Table is stand alone and form is just used for updating information.

1. I would like to have it setup so that when you start typing the first name it "autocompleted"
Example: Type "Jas" and it reads "Jason" from the table

2. When you have entered enough criteria for it to be isolated to one record, it populates the remaining texts boxes.
Example: Only 1 Jason (first name) in the table, so when the user types in Jason it populates the remaining text boxes.
Example: John Smith and John Doe (first name / last name) in the table, so when the user types in John it DOESN'T fill...but when user types in John and Doe it completes the rest of the form.

Thanks for your help.
Jeff B.
Here's an alternate approach...

Create a form that is "fed" by a query that reads your table.

Add an unbound combobox to the header. As a source for the rows display, use a query that returns the rowID, "LName, FName" and any other data the user would need to identify the correct name/person.

In the AfterUpdate event of that combobox, add something like:
Me.Requery

Now change the form's underlying query to include a selection criterion on the rowID field ... have it point to the form's unbound combobox.

Here's how it works:

1. You open the form. The query looks in the (empty) combobox and returns that (i.e. none) record.
2. You start typing in the combobox ("Doe, ...") -- there's a property that auto-completes in the combobox.
3. When you have the correct record selected, hit <Enter>.
4. The AfterUpdate event fires, tells the form to requery, which re-runs the underlying query.
5. The underlying query looks in the combobox, finds a rowID, and returns that record to the form.
6. The form's controls are filled in!

Is that what you were after?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.