lstBox value returns null

  • Thread starter Thread starter Mick
  • Start date Start date
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
 
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
 
Back
Top