Use combo box to lookup data in a form? (auto-complete)

G

Guest

Sorry, it's been years since I've had to design db....

I'd like to use a form based on a query to lookup (and autocomplete)
lastname+ " " + firstname based on a table containing personnel information.
I remember using a listbox that would auto complete, but can't find any of my
old reference materials.

In addition, I had a book that basically listed all the commands used in
the Access Programming language, their syntax and examples. It was not a
tutorial, but just a simple reference. I thought it was Programming in MS
Access 2000, but the similar title by Rick Dobson is not the book I was
looking for. Any ideas?
 
M

Marshall Barton

SterlingBP said:
Sorry, it's been years since I've had to design db....

I'd like to use a form based on a query to lookup (and autocomplete)
lastname+ " " + firstname based on a table containing personnel information.
I remember using a listbox that would auto complete, but can't find any of my
old reference materials.

In addition, I had a book that basically listed all the commands used in
the Access Programming language, their syntax and examples. It was not a
tutorial, but just a simple reference. I thought it was Programming in MS
Access 2000, but the similar title by Rick Dobson is not the book I was
looking for. Any ideas?


AutoComplete is a ComboBox feature. To use it as a search
capability, place it in the form's header section and leave
its ControlSource property blank. Make sure that its
RowSource query includes the primary key field in the person
table:
SELECT keyfield, lastname & ", " & firstname As FullName
FROM peopletable
ORDER BY lastname & ", " & firstname
Set the ColumnCount property to 2, BoundColumn to 1 and the
LimitToList to Yes.

Then use the combo box's AfterUpdate event to navigate to
the matching record in the form:
With Me.RecordsetClone
.FindFirst "keyfield = " & Me.combobox
Me.Bookmark = .Bookmark

The form's RecordSource would be bound to a similar query:
SELECT *
FROM peopletable
ORDER BY lastname & ", " & firstname

I don't know about the book you're looking for, but Access
Help is a decent reference source. Open Help from the VBE
window and select the Contents tab. You can find a list of
the statements, functions, etc in the VBA Language Reference
topic.

Don't forget the Object Browser as a useful way to get to
Help on a specific item.
 

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