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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlookup in query criteria 1

Status
Not open for further replies.

Spaniard

MIS
Jul 23, 2002
29
US
Hi,
I have a field of values in Table1 that need to be entered into another field in Table2 via a list box. However, the values must be restricted to those that have not yet been entered into Table2. For example, if a user selects and saves a value (from Table1), that value must not be available for the user to select again - it must 'disappear' from their view.

I have been told that DLookup might be what I am looking for, but I don't see how that applies or if it does, where to put it. Would it be in the criteria for the field in the query or in code from an event?

Thanks,
SWK
 
dlookup would return a value but I think you are looking for something like this

If I understand what it is you are asking

set the listboxes rowsource to

select yourindexfieldname from table2 yourindexfieldname where not in (select yourindexfieldname from table2)

will need to custimize toyour needs

or you could base it on a query uing a leftjoin and look for nulls

hope that is what you had in mind
 
The query upon which this list box is based has several criteria, so I couldn't set the rowsource as you had suggested but you triggered something in my brain and I am fairly close now...just a little more tinkering and I think I'll get it.

Thanks for the help.

SWK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top