Type Mismatch

DonnyF

Board Regular
Joined
Apr 25, 2017
Messages
76
Hello,

I am trying to filter out one particular customer in a query and get the error type mismatch.

In my criteria row for 'CompanyName' I put:

<>"Astro Racing"

What am I doing wrong?

Thank you for the help,
Donny
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I think this might be one of those errors that requires someone to have access to the database to see what is going on.
 
Upvote 0
Are you sure it isn't a lookup field? It wouldn't make sense to save the company name as a text field in the workorder table.

Try running this query:

Code:
SELECT CompanyName & "" AS TestName FROM  Workorder

Are you given a list of company names as expected or a list of underlying numbers?
 
Upvote 0
There is a Workorder form that has a combo box to select and add to the companyname list that populates the Customer table. The query is based on the Customer table the has the field CompanyName.

Do these details help?
 
Upvote 0
Yes. What is the Primary Key field in the Customer Table?
Usually, that is the value that is being selected (but not always the value being displayed).
My guess it is a numeric field, which is the reason for your error.

Try adding the Customer Table to your query, joining on the Primary Key field.
Then, add the display field to the query, and place your criteria under that.
 
Upvote 0
The primary key is an autonumber in the Customer table. I don't know how to add the customer table to the query.
 
Upvote 0
Simply go into Design View of your query, right-click in the space where it shows you existing table, and select "Show Table".
Then select the Customer table from that list.
It may even automatically create the join between the two tables for you.
 
Upvote 0
In the main Relationships window the ID (primary key) from the Customer table is joined with CompanyName in the Workorder table.
 
Upvote 0
If you do not see the join between the two tables in the query, you can create it simply by dragging a line between the two fields it is matching on.
If you do not know how to do this, watch this video (around the 45 second mark): https://www.youtube.com/watch?v=qceAxjRciXI
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top