testing for null fields

G

Guest

Hi,

I am building an Access query in which it gathers info from a form.

I want to be able to say if the form variable is No then I want to check for
Null field
but if the form variable is a Yes then I want to check for non-null field.

Is this possible and if so how do I go about accomplishing this.

Thanks
bbdobuddy
 
K

Ken Snell [MVP]

You're building the query's SQL in code? Then use a code step similar to
this as needed:
If MyFormVariable = "No", "Is Null", "Is Not Null"

this result needs to be concatenated into your SQL string at the proper
location.

If this is not what you're doing, then you'll need to tell us more
information about your setup.
 
G

Guest

Not exactly

I am in the query design mode and I am trying to build that expression in
the criteria box

bbdobuddy
 
K

Ken Snell [MVP]

You cannot directly get a variable from your form's module into the query.
You'll either need to write the value of the variable into a hidden textbox
on the open form and have the query read the value from that textbox, or
you'll have to write a public function that returns the value of that
variable and then call that function in your expression in the query.

Are you sure you're needing to get the value of a variable?
--

Ken Snell
<MS 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

Top