lstBox value returns null

M

Mick

Hi

Am implementing a password system on a form.

There is a table holding UserNames and Passwords.

I have built a query that takes the contents of a textbox on a form as
a criteria and returns the correct password into a listbox on the
form.

All I now need to do is compare the entered password with the returned
value but if I try to do it directly:

if listboxvalue = passwordvalue then.....

or I read both into string variables and then compare them I get a
null error when trying to read out of the list box.

How do I grab the selected value from a listbox.

Many thanks

Mick
 
K

Ken Nguyen

Hey Mick,

If i am understanding you correctly

you need to let it know what column/row to get the value from the listbox

if there is only 1 value (password) in the listbox then you need to call it

i.e.

listboxvalue.column(0,0)

If there are multiple passwords in the listbox then

what you need to do is go through the listbox to find a matching password.

The listbox contains many values (passwords) so it doesn't know which to
grab.

If you use a for next loop you can iterate through the listbox to find a
matching password


Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top