Populate Textbox




I have a table with part numbers and locations. There are multiple
locations per part number. I would like to populate a listbox with a
filtered list of the locations for the part number shown on my form. I'm not
very good at vba and have been looking all over for code, but can't find
anything suitable.



You have multiple locations per part number. So first, let's get your form
set up correctly. When you have a one-to-many format (one salesman, many
products or one part number, many locations) you need a form and subform. The
Mainform would be for your part numbers (the One.) The subform for your
locations (the many.) So it might help if you set that up first. Then it is a
simple combo box you need to search. Put a combo on the mainform. Allow the
combo box wizard to set that up for you with your part numbers. Then right
click on the combo, go to events, go to the Afterupdate event, click the
button out to the right, open the code builder, and type:
Me.filter = "[locations] = """ & Me.combo# & """"
Me.filteron = true
The combo number will be listed, like combo10 or combo22

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