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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Selection Question

Status
Not open for further replies.

rogle

Technical User
Dec 17, 2003
4
US
I have a listbox bound to a table field named roll. I want to be able to select from the listbox and display the last record of another table named vendor whose field name matches the selection. Sounds pretty easy but it is kicking my butt. Any help would be apprecitated.
 
Depends on how much knowledge you have with VBA, but I would do the following:

Create a function for the AfterUpdate event of the list box to find the record in the vendor table that you want to display. Use this to filter/show the appropriate values...

Couple of questions, though, that might make this a bit easier. How is your "form" fet up? Is the recordsource of the form the vendor table? Can you describe your setup some so I can help you find the appropriate solution???

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
rogle
There may be other ways but one way to do it would be by using the DMax function.

I'm not sure of how you have things set up, but it looks as if the field "Roll" is in both tables, and that the tables are joined on that field. Based on that assumption, your text box control source could be something like...

=DMax("Roll","tblVendor","Roll = " & [Forms]![YourFormName]![Roll] & "")

I have assumed the field "Roll" is a number. If it's text you will have to add apostrophes in the Where condition. In other words...
=DMax("Roll","tblVendor","Roll = '" & [Forms]![Form9]![Roll] & "'")

Anyway, hope this is a push in the right direction.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top