Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to verify if already in listbox 1

Status
Not open for further replies.

pinstripe

Programmer
Dec 27, 2004
52
i have a listbox1 filled from table1

have another listbox2 filled from table2
they are on different forms
on the form with the listbox2- there are 3 buttons (in list1, not in list1, show all)

now, 1 and 3 button works fine but with the 2 i have a problem
it returns some of the items which are not in the listbox1 but there are more items then what it is showen

i understant i should paste the code in here for your further understanding of this problem but i am working now - and my mind is on this problem

maybe someone can halp me in spite of that

it is a SQL in VBa code (effect on rowsource)
(or you might know some general verification way)
thx for the help
 
listbox2.rowsource =
SELECT Col1, Col2 FROM table2
WHERE NOT EXISTS
(SELECT Col1 FROM Table1
WHERE table1.Col1 = Table2.Col1)

The second select statement is essentially the row source for listbox1 but needs to be linked via the common column of both tables.

post if you need more help

Savil
 
thank's Savil for your help

i have solved the problem with the IS NULL in the WHERE part!
i didn't wanna to change too mutch what i already had - in spite of the fact that your example looks more doable

enyway i have another question - about DLOOKUP

how can you make more than one criteria - i have like:

if (DLookup("[Model]", "[BOM L1]", ("[Model]= '" & [Forms]![BOM L1]![List100].Column(1) & "'"))) then ...

what i would like to have is:

AND (DLookup("
Code:
", "[BOM L1]", ("[Code]= '" & [Forms]![BOM L1]![List100].Column(2) & "'"))) then ....

but it is not working ! ??
 
So, where's the problem with the code you've written?


if ((DLookup("[Model]", "[BOM L1]", ("[Model]= '" & [Forms]![BOM L1]![List100].Column(1) & "'")))) AND ((DLookup("
Code:
", "[BOM L1]", ("[Code]= '" & [Forms]![BOM L1]![List100].Column(2) & "'")))[COLOR=red])[/color] Then ...[/b]

Randy
 
yes i have found that out -->this was what i have been missing
it is working now

thank you both
regards

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top