passing a value from a text box to a list box (1 Viewer)

duke217

Registered User.
Local time
Today, 20:59
Joined
Jan 23, 2018
Messages
17
Hi all,

My issue:

I have a text box, called CID on a form.

With a click of a button I would like to pass the value of that text box to a box where I see a list of values taken from a table (the name of the list box is Customer)

I used this in the code for the onclick event of the button:

Me![Customer].value = Me![CID].value

And when I click, I get error 2113 : the value you entered is not valid for this field

It is gently driving me a little bit crazier than I already am :banghead:

any thought, o ye the wise?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:59
Joined
May 7, 2009
Messages
19,230
your code will work, but...

did you include the CID (ID) on
the Listbox, and set the Listbox's
Bound Column Property to CID?

If CID is in column 1 you set
also the Bound Column (Property->Data) to 1,
else to whichever column the CID is.
 

duke217

Registered User.
Local time
Today, 20:59
Joined
Jan 23, 2018
Messages
17
Thank you so much for your reply, Arnel.

It triggered two more questions:

1. How do I include the CID(ID) in the list box?

2. The Bound Column numbering starts from 0 or 1?

Thank you again
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:59
Joined
May 7, 2009
Messages
19,230
drag a new listbox to your form.
the wizzard will guide you. make
sure to select CID first.
the wizzard will ask you if you
want to hide this field, choose Yes.
you can delete the old listbox
and name this new listbox as the
previous one.

bound column start with 1.
 

duke217

Registered User.
Local time
Today, 20:59
Joined
Jan 23, 2018
Messages
17
Aaahhhh. It worked. My brain just stopped itching.

Thanks a lot!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:59
Joined
May 7, 2009
Messages
19,230
Now you saved a tablet of pain reliever.
 

Users who are viewing this thread

Top Bottom