module coding in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top