Creating Combobox (Newbie Question )

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create combo box that will allow me to enter info but will
also allow me to pull up previous enteries in that field. But I don’t want it
to display doubles, and I want that when I go to a new record it will have
allready added it to the list without requiring me to close the form. Thank
You.
 
Assuming the combo is bound to a field named "MyField", you could set these
properties:

Row Source: SELECT DISTINCT [MyField] FROM [MyTable] ORDER BY [MyField];
Limit To List: No
After Update: [Event Procedure]

Then click the Build button (...) beside the Afterupdate property.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, enter:
Me.[MyField].Requery
That should bring it up to date as soon as you enter a new value.

That approach is okay for a really simple scenario with just a few values
and where it doesn't matter if they are correct or not, but you may want to
consider doing the job properly by creating a lookup table of the valid
values for the combo. To have the new values added to the table, see:
NotInList: Adding values to lookup tables
at:
http://members.iinet.net.au/~allenbrowne/ser-27.html
 

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

Back
Top