Creating a query that makes a comparison within a record

D

Doug

I have one table that has records that contain information on different
properties. I want to create a query that shows all the records where the
owner address does not match the property address (which properties are
non-owner occupied). How do I do this?
 
M

Marshall Barton

Doug said:
I have one table that has records that contain information on different
properties. I want to create a query that shows all the records where the
owner address does not match the property address (which properties are
non-owner occupied). How do I do this?


Just use a WHERE clause that only accepts records where the
two fields a different.

WHERE OwnerAddress <> PropertyAddress

If the query design grid you can use a criteria under the
OwnerAddress field:
<> PropertyAddress
 
D

Doug

When I do that Access tells me that I have a data type mismatch even though
both fields I am comparing are numbers. Access insists on putting the field
name in quotes. Does this change it to text? How do I keep this from
happening?
 
M

Marshall Barton

Doug said:
When I do that Access tells me that I have a data type mismatch even though
both fields I am comparing are numbers. Access insists on putting the field
name in quotes. Does this change it to text? How do I keep this from
happening?


If it was put in quotes, it will be treated as text and then
you get that error. This usually happens when you mistype
the field name, but you can force the issue by placing [ ]
around the name in the criteria:

<> [PropertyAddress]
 
Top