Multiselect Listbox add records

What is the purpose of this line:

If Not Me.List0.ItemData(vtlm) Then

The logical expression will only execute if Me.List0.ItemData(vtlm) evaluates to False.
 
Its

If Not Me.List0.ItemData(vtlm) Then

is the same as


If Me.List0.ItemData(vtlm) Not NULL Then

It just tests to see if anythink is selected in the first list box. It looks at Null Not Null not true false.

You could say.

If Me.List0.ItemData(vtlm) null then

msgbox "null"

Else

'logical expression


I dont think thats the problem here i really need to know if

-- would the other method "rst.FindFirst " look at the contents of the destination list box to compare or the contents of the table?

And if it can how?

Thanks
 
Aha. If you want to check to see if anything is selected in a multiselect listbox, an easy method is:
Me.List0.ItemsSelected.Count

To look at the contents of any listbox, you need to know what feeds into it. You can use this expression:
strSQL=Me.List0.Rowsource
and strSQL will then be assigned a SQL string that will tell you what goes into the listbox. It will be in this form:
SELECT table.field FROM table;

When I typically tackle this problem, as I stated before, I copy all possible choices for both listboxes into a temp table. That way, I know what feeds into them. Then I just use a yes/no field to decide which record goes into which listbox.
 
Thanks for your help I seem to have everything i need working, using a combination of code and temp tables.

Now if i can just get someone to do all the data entry :)

Thanks
 
Now if i can just get someone to do all the data entry
*Sigh* An Access programmer's work is never done....
 

Users who are viewing this thread

Back
Top Bottom