module coding in query

R

Russ

I have a query of many clients and use a code to look at fields in a child
table. Not every client in the query has a record in the child table. The
code takes 5 fields from the child table and puts them in the form of AA, BB,
CC. It does include the child fields that are false. The code is run as a
field in teh query. the problem is for those records where the client does
not have a record in the child table, i get an error. How do i fix my code so
that it will not run for those clients who do not have a record in the child
table?
i have tried something like:
if rst is emtpy then string is null ?????

thank you for your help,
russ
 
M

Michel Walsh

Hi,


Empty means the variable has not been define yet. You can use, in VBA,
something like:


If IsNull(rst.Fields("myField") ) Then

... ' myField has a null value

Else

... ' myField has a not null value

End if




but you can also filter the data in the query, in the first place, using
either an inner join rather than an outer join, or a where clause like:


.... WHERE Not( Myfield Is Null)



Hoping it may help,
Vanderghast, Access MVP
 
Top