populate textboxes from listbox selection

magster06

Registered User.
Local time
Today, 17:35
Joined
Sep 22, 2012
Messages
235
Hello all,

I am trying to populate textboxes on my form when I make a selection from my listbox.

I populated the listbox with a query and this works as it should.

The query loads two columns in the listbox. One is an id (FDID) and the other is the persons last name.

I tried using the control source of the textboxes to get the info from the listbox, but it will only populate 2 out of the 5 textboxes. The ones that populate, of course, are the FDID and last name.

How do I get the rest of the values from the table?

I did a search, but nothing I found fits my needs.

Thanks ahead of time!
 
I would add the fields to the listbox row source (you can hide them) and get the values the same way you get the others.
 
Thanks for the reply!

I'll give your suggestion a try.

Isnt there some way with vba code? just curious.
 
You could use the DLookup() function to populate an unbound text box based on the current selection in your Listbox. However I believe pbaldy's suggestion will be more efficient.
 
I first want to thank both of you for your replies.

pbaldy,
How I extracted the values from the 2 columns was by putting the following in the control source of the textboxes:

=[lstCFDWitnesses].[Column](0)
=[lstCFDWitnesses].[Column](1)

and so on...

I added the other 3 columns as you advised and now all of the info from the listbox populates the textboxes as I had wanted.

About the vba code, I just thought maybe there was an easier way, but I guess your way was pretty easy, lol.

Thanks again for the help!
 

Users who are viewing this thread

Back
Top Bottom