Access Question

Posted by: lectric

Access Question - 09/06/2004 13:07

Assume I have a database with a field that may or may not be null. It is easy to make a query based on this to list all records that are empty of that have data in this particular field. What I am looking for is a way to represent the presence of data with a checkbox on a report that shows ALL records, not a filtered subset. Is this possible?
Posted by: wfaulk

Re: Access Question - 09/06/2004 13:44

Of course, but I have the feeling that you're talking about a specifc tool, and without knowing what tool that is, there's no way to help you.

Edit: You know, if I'd read the title....
Posted by: Mach

Re: Access Question - 09/06/2004 16:04

I believe that you can use the isnull function which returns a true/false result. You can use this directly in the Access QBE grid definition or within a control on a form.

If I understand what it is that you are trying to do, you'll likely want to use in the query definition.

IsNull Function


Returns a Boolean value that indicates whether an expression contains no valid data (Null).

Syntax

IsNull(expression)

The required expression argument is a Variant containing a numeric expression or string expression.

Remarks

IsNull returns True if expression is Null; otherwise, IsNull returns False. If expression consists of more than one variable, Null in any constituent variable causes True to be returned for the entire expression.

The Null value indicates that the Variant contains no valid data. Null is not the same as Empty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.

Important Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null and, therefore, False.
Posted by: lectric

Re: Access Question - 09/06/2004 21:20

OK, got it. In a query, I brought in the field that contained the data I was looking for. In another field I used "expr1: [field1] is null". That returned a boolean 0, -1 value which translated easily into a checkmark on a report. Thanks for the input.

Basically what it is is a list of all my movies/cd's. I had a field that showed who had "check out" a particular item. The field contained the person's name. If it was null, I wanted to show that it was not "checked out" Later, I wanted to be able to print out a report listing all my stuff, showing whether an item was "in stock" without having to show who actually had it checked out, since that's nobody's business but mine. And I wanted to be able to do this without having to check off a button in the lookup form. More or less it was an exercise to see how to do it, not that it was really necessary.

Make sense?
Posted by: Mach

Re: Access Question - 09/06/2004 21:48

Makes sense.

You could also setup field on the report that did a if(len([checkedout])>0),"Checked Out","In Stock")
Posted by: lectric

Re: Access Question - 10/06/2004 06:57

Ahhhh..... Elegant.