Help with List Boxes

G

Guest

I have created a list box in my form that lists client names, when a client
is selected it fills in the form with stored data. However, I want users to
be able to add a new client name and fill out the form if the client is not
already in the list. I also want the list to update once new entries are
added or old ones are removed. I'm new to Access so I need some basic help..
 
G

Guest

For what you are doing, a combo box would be a better choice than a list box;
however, in either case, you will want to requery the control when entries
are added or removed. Not knowing your form, I can't say exactly where to
put it.

Me.MyListBox.Requery
 
G

Guest

I've create a combo box with the fields selected as "ContactLastName" and
"ContactFirstName," in the dropdown box both first and last names are
displayed, but once I select a name only the Last name is displayed. Can you
tell me how to create the option of adding a new client?
 
G

Guest

As to the names in the combo, you could create an additional column in the
combo that would be the first and last names concatenated.

Typically when you want to add a new entry using a combo box, you use the
Not In List event. You will want to set the Limit To List property to Yes.

In the Not In List event, you can create the code to add the new record.
There are a number of ways to do this. One is to open a form that will allow
you to entery the information for the new client. Another is to use SQL to
append a new record with key fields filled in, then make it the current
record in the form so you can enter the additional information. In either
case, you will want to requery the combo so it will include the newly added
record.

If you need more detail, let me know which way you want to do it and I can
help with the code, if you need it.
 

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