?
Solved

Auto-Complete using previously entered values in Access 2007

Posted on 2007-10-21
11
Medium Priority
?
3,702 Views
Last Modified: 2013-11-28
Hi,
When I entering new data to a new record in a text type field in Access 2007, what's the way of "auto-complete this field using previously entered values" ?
Thanks
0
Comment
Question by:cisilay
  • 6
  • 5
11 Comments
 
LVL 58

Expert Comment

by:harfang
ID: 20119279
Just copying the previous value is Ctrl+?

If you want to create a combo, let's imagine the source of your form is Table1 and the field is Field1, you would use this Row Source:

    SELECT DISTINCT Field1 FROM Table1 WHERE Field1 Is Not Null;

And add this to the AfterUpdate event:

Private Sub cboField1_AfterUpdate()
    cboField1.Requery
End Sub

Good luck!
(°v°)
0
 

Author Comment

by:cisilay
ID: 20120578
I will give you an example from excel :
I enter a text to the cell a1 (Elvis Presley)
When I go the cell b1, and begin to enter (Elvis Presley) again, this cell remember the previous value and auto complete the cell with this word. If you want to enter to the next cell (Elvis Costello), you have to wait till the beginning of (Costello) to auto complete. The question is, can I use the same facility in access 2007 and how ?
And don't forget, I'm a novice and I need your help more detailed. Where and how can I enter these expressions..
Thanks.
0
 
LVL 58

Expert Comment

by:harfang
ID: 20120729
Perhaps Access 2007 has this built-in, I wouldn't know. Up to Access 2003, I know that my suggestion above is a good solution.

However, it requires some skills in Access (creating a combo box), in queries (create a DISTINCT query) and in VB (creating the event procedure).

Let's start with the combo box.

Right-click your text box and select (Change To | Combo Box). This isn't too hard. Now open the properties and find the Row Source. This is where you have to type or create your query.

Copy the query I gave you, replacing the table and field names with the appropriate names.

Then tell me how it went.

Good luck!
(°v°)

0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

Author Comment

by:cisilay
ID: 20120880
The first part (for combo box) is OK.
But I don't know where to enter AfterUpdate event. That's why the auto complete doesn't work.
0
 
LVL 58

Expert Comment

by:harfang
ID: 20121034
The auto complete will work as soon as you have created the combo box with the appropriate row source.

The after update event is just a final polishing: making sure that a new entry is available directly in the next record. Without it, you need to close and re-open the form to see a new item in the list.

Does it work so far? Does your combo show all entries already in the table?

Anyway, to create the after update event:
* open the property sheet for your combo
* find the "after update" property"
* select [Event Procedure]
* click the builder button, looking like this: [...]
* add the line of code inside of the generated Sub

Good luck!
(°v°)
0
 

Author Comment

by:cisilay
ID: 20121293
1. The combo box now is working. But when I enter a new name, I must close and reopen the form.
2. I cannot find the "after update" in the combo box property sheet. Like I said I have no idea about these functions and I have to learn but some of them are important for me to begin. This one is one of them.

After all thanks to you for your help.
Regards.
0
 
LVL 58

Accepted Solution

by:
harfang earned 900 total points
ID: 20121381
No problem, and I'm glad it's working so far.

With your form in design view, select the combo (not the attached label) and display the property sheet. You will notice that it's tabbed, so that the After Update property might not be visible. It's on the [Events] tab (second line) and also on the [All] tab.

Cheers!
(°v°)
0
 

Author Comment

by:cisilay
ID: 20121452
OK it's OK now.
Thanks a lot and regards.
0
 
LVL 58

Expert Comment

by:harfang
ID: 20121489
Glad it worked. Can I ask why I deserved only a B?
(°v°)
0
 

Author Comment

by:cisilay
ID: 20121506
I think B is good enough, but if you give some pts to me, mine will be C.
0
 
LVL 58

Expert Comment

by:harfang
ID: 20121531
I don't understand what you mean with "mine will be C".

You probably don't realize that the question has the same "cost" to you regardless of the grade, so this is not an issue. However, the points received do depend on the grade: it's a multiplier. In this case, I do resent your reaction: "I think B is good enough". The polite thing to do would be at least to explain yourself.

You might also want to read: http:/help.jsp#hi73

(°v°)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question