How do I get a value from a control on another form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.

I have a listbox on a form, call it "form A" that is populated a table in my
database. Also on "form A", I have a button that opens "form B", and closes
"form A".

I want to know how I can grab the value of the listbox from "form A", when I
am presently in "form B"? It seems like it should be an easy solution but I
just can't figure it out.

Thanks!
 
varWhatever = Forms("form A").Controls("ListBoxNameHere").Value

The form "form A" needs to be open when this code runs, so make sure you
place this code *before* the code that closes the form.
 
Thanks a bunch! I got it working now.

Brendan Reynolds said:
varWhatever = Forms("form A").Controls("ListBoxNameHere").Value

The form "form A" needs to be open when this code runs, so make sure you
place this code *before* the code that closes the form.
 
Back
Top