if(iserror) equivelent in Access 2003. How to write a nested if (else if Error) statement in access 2003

kgittinger
kgittinger used Ask the Experts™
on
I would like to write an if/iserror statement to return the ID# from one of 6 queries. I would like to say if ID# (in query 1 is null, look to query 2, if that is null look to query 3 but if the ID# is not null in query 2 say Query2.  So I can track movement of this ID#.  In Excel I would use =if(iserror(vlookup...

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Architect / Application Developer
Top Expert 2007
Commented:
Public Function mID()

IF Not IsNull(DLookup("ID","Query1") ) Then
    ' do whatever
    Exit Function
End If

IF Not IsNull(DLookup("ID","Query2") ) Then
    ' do whatever
    Exit Function
End If

IF Not IsNull(DLookup("ID","Query3") ) Then
    ' do whatever
    Exit Function
End If

 ' and so on for all the queries

End Function

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial