Populate Textbox

  • Thread starter Thread starter LFC
  • Start date Start date
L

LFC

Hi,

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.

Thanks
 
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
 
Back
Top