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!

Look up another table

Status
Not open for further replies.

sinyce

IS-IT--Management
May 27, 2002
57
US
I have two tables:

CUSTOMER TABLE
CUSTID CCY AMOUNT TYPE
10001 USD 9.99 2
10002 CAD 8.88 99
10003 JPY 7.77 99

COUNTRY TABLE
CUSTID
10001
99999
88888
...

The TYPE in [CUSTOMER TABLE] is set to 99
unless the CUSTID is present in [COUNTRY TABLE]
then it is set to 2.

is there a way to do this with a DLookup? or an
Expression on the Query?
 
As you leave your CUSTID in your COUNTRY TABLE you could do a dlookup in coustomer tbl, something like this

Dim MyDb as Dao.Database
Dim IsThere as boolean
Set mydb=currentdb
IsThere = dlookup("CUSTID","coustomer","CUSTID=" & me!CUSTID)
if IsThere then
mydb.execute ("Update coustomer Set CUSTID=2 Where CUSTID=" & me!CUSTID)
end if
Should do the trick ;-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top