run sql if value not in table?

Z

zionsaal

how do I create a if then statment like this
if me."controlname" is in this table where... then run sql
else
dont run

anyone can help?
thanks
 
D

Damian S

Hi,

How about something like this:

if not isnull(dlookup("FIELDNAME", "TABLENAME", "FIELDNAME = " &
me.CONTROL)) then
' run your sql code
docmd.runsql "SQL code goes here"
endif

Damian.
 
Top