Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating drop down boxes from a field on a form 1

Status
Not open for further replies.

robojeff

Technical User
Dec 5, 2008
220
US
I have a query which pulls the info out of a text box (Me.part) on my form (My_frm) and I would like to populate 2 drop down boxes (Me.lotsn with LC) & (Me.loc with Location) on the same form from information that is derived from the query.


SELECT T1.PN AS Part, T2.LOC AS Location, T2.LOT AS [LC]
FROM T1 INNER JOIN T2 ON T1.ITM = T2.ITM
WHERE ((T1.PN)=[forms]![My_frm]![part]);

How do I set up the row source of the drop down boxes with the results of the query so that every time the part number changes, the query is run to update the dropdown list data?

thanks
 
How are ya robojeff . . .

In the forms [blue]On Current[/blue] event, requery the comboboxes:
Code:
[blue]   Me.lotsn.Requery
   Me.loc.Requery[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks Aceman-

Does this mean that I need to set the row source or record source of the drop down boxes to the appropriate field of the query?

I tried setting the record source of the form to the query and when I do this, the form opens up blank with no controls showing...

 
robojeff . . .

Not trying to sound this way or that, but its [green]comboboxes[/green] ... not [blue]drop down boxes [/blue] [surprise]

The [blue]RowSource[/blue] for [blue]lotsn[/blue] should be ...
Code:
[blue]SELECT T1.PN AS Part, [purple]T2.LOT AS [LC][/purple]
FROM T1 INNER JOIN T2 ON T1.ITM = T2.ITM
WHERE ((T1.PN)=[forms]![My_frm]![part]);[/blue]
... and for [blue]loc[/blue] should be:
Code:
[blue]SELECT T1.PN AS Part, [purple]T2.LOC AS Location[/purple]
FROM T1 INNER JOIN T2 ON T1.ITM = T2.ITM
WHERE ((T1.PN)=[forms]![My_frm]![part]);[/blue]
The code I gave on [purple]16 Oct 09 9:07[/purple] does the rest.

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks Aceman...

once again your have helped me out big time!
 
Maybe you should try the resources in your division before posting? They maybe helpful!!
 
What resources might that be CCV?

Please explain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top