Solved

Data type mismatch in criteria expression

Posted on 2008-10-19
6
1,014 Views
Last Modified: 2013-11-27
I have a query in which i am trying to select all the fields that are either blank or null. I the Criteria I am using the expression "" Or Is Null to try and accomplish this. I am however getting the "Data type mismatch in criteria expression" I have no idea why this is happening. The field I am running this criteria on is a date time field.
0
Comment
Question by:onaled777
  • 2
6 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 22754585
remove "" , just use Null
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 22755291
Can you give us your query?
0
 

Author Comment

by:onaled777
ID: 22760040
Attached is my query. Thanks again for  your help
SELECT [Main Table].[Unique Number], [Main Table].Season, [Main Table].EBANumber, [Main Table].Customer, [Customer List].Ranking, [Main Table].StyleNumber, [Main Table].FabricNumber, [Main Table].Fabric, [Main Table].Color, [Main Table].Quantity, [Main Table].[DYE Lot], [Main Table].Body, [Main Table].Garment, MacysSKUNumber.MacysSku, [Main Table].[CXL Date], [Main Table].OriginalBaseline, [Main Table].[Revised Export Date], [Main Table].Factory, [Main Table].[Cut Recieved Date], [Main Table].[Cut Released Date], ManufacturingTracking.FabricDispatch, ManufacturingTracking.INCut, ManufacturingTracking.INSew, ManufacturingTracking.INPress, ManufacturingTracking.Audited, ManufacturingTracking.Shipped, ManufacturingTracking.UnitsCut, ManufacturingTracking.UNITSSHIPPED, IIf(IsNull([ManufacturingTracking]![INCut])," ",[ManufacturingTracking]![UnitsCut]-[Main Table]![Quantity]) AS [CUt Vs Ordered], IIf(IsNull([ManufacturingTracking]![Shipped])," ",[ManufacturingTracking]![UNITSSHIPPED]-[Main Table]![Quantity]) AS [Ship Vs Order], ManufacturingTracking.PlantComments, ManufacturingTracking.DailyAction, IIf(IsNull([Main Table]![OriginalBaseline]) Or IsNull([Main Table]![Revised Export Date]),"TBD",IIf([Main Table]![Revised Export Date]=[Main Table]![OriginalBaseline],"Same",IIf([Main Table]![Revised Export Date]<[Main Table]![OriginalBaseline],"Better",IIf([Main Table]![Revised Export Date]>[Main Table]![OriginalBaseline],"Worse"," ")))) AS [Worse or Better than Baseline], IIf([Worse or Better than Baseline]="Worse" Or "Better",[Main Table]![OriginalBaseline]-[Main Table]![Revised Export Date],"") AS [By How Much], [Main Table]![CXL Date]-54 AS [Pattern Deadline], [Main Table].[Pattern#], [Main Table].[PDM Date], [Main Table].[PTTN Date], [Main Table].[Approval Date], [Main Table].Yield, ([Main Table]![Yield]/36)*[Main Table]![Quantity]*1.03 AS [Yards Required], [Main Table].Cafta, [Main Table].[Briggs Direct], [Main Table].[Actual Shipped Date], IIf(IsNull([Main Table]![Actual Shipped Date])," ",[Main Table]![Actual Shipped Date]-[Main Table]![OriginalBaseline]) AS [Difference Vs Baseline], [Main Table].[Actual Shipped Quantity], IIf(IsNull([Main Table]![Actual Shipped Quantity])," ",[Main Table]![Actual Shipped Quantity]-[Main Table]![Quantity]) AS [Difference Vs Order], [Main Table].[DC Location], [Main Table].[Ship Method], [Main Table].[Container #], [Main Table].[Authorization Date], [Main Table].[EBA Mapping]

FROM (([Main Table] LEFT JOIN [Customer List] ON [Main Table].Customer = [Customer List].Customer) LEFT JOIN ManufacturingTracking ON [Main Table].[Unique Number] = ManufacturingTracking.UniqueNumber) LEFT JOIN MacysSKUNumber ON [Main Table].MacysUnique = MacysSKUNumber.MacysUnique

WHERE ((([Main Table].[Actual Shipped Date])="" Or ([Main Table].[Actual Shipped Date]) Is Null));

Open in new window

0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 22760161
SELECT [Main Table].[Unique Number], [Main Table].Season, [Main Table].EBANumber, [Main Table].Customer, [Customer List].Ranking, [Main Table].StyleNumber, [Main Table].FabricNumber, [Main Table].Fabric, [Main Table].Color, [Main Table].Quantity, [Main Table].[DYE Lot], [Main Table].Body, [Main Table].Garment, MacysSKUNumber.MacysSku, [Main Table].[CXL Date], [Main Table].OriginalBaseline, [Main Table].[Revised Export Date], [Main Table].Factory, [Main Table].[Cut Recieved Date], [Main Table].[Cut Released Date], ManufacturingTracking.FabricDispatch, ManufacturingTracking.INCut, ManufacturingTracking.INSew, ManufacturingTracking.INPress, ManufacturingTracking.Audited, ManufacturingTracking.Shipped, ManufacturingTracking.UnitsCut, ManufacturingTracking.UNITSSHIPPED, IIf(IsNull([ManufacturingTracking]![INCut])," ",[ManufacturingTracking]![UnitsCut]-[Main Table]![Quantity]) AS [CUt Vs Ordered], IIf(IsNull([ManufacturingTracking]![Shipped])," ",[ManufacturingTracking]![UNITSSHIPPED]-[Main Table]![Quantity]) AS [Ship Vs Order], ManufacturingTracking.PlantComments, ManufacturingTracking.DailyAction, IIf(IsNull([Main Table]![OriginalBaseline]) Or IsNull([Main Table]![Revised Export Date]),"TBD",IIf([Main Table]![Revised Export Date]=[Main Table]![OriginalBaseline],"Same",IIf([Main Table]![Revised Export Date]<[Main Table]![OriginalBaseline],"Better",IIf([Main Table]![Revised Export Date]>[Main Table]![OriginalBaseline],"Worse"," ")))) AS [Worse or Better than Baseline], IIf([Worse or Better than Baseline]="Worse" Or "Better",[Main Table]![OriginalBaseline]-[Main Table]![Revised Export Date],"") AS [By How Much], [Main Table]![CXL Date]-54 AS [Pattern Deadline], [Main Table].[Pattern#], [Main Table].[PDM Date], [Main Table].[PTTN Date], [Main Table].[Approval Date], [Main Table].Yield, ([Main Table]![Yield]/36)*[Main Table]![Quantity]*1.03 AS [Yards Required], [Main Table].Cafta, [Main Table].[Briggs Direct], [Main Table].[Actual Shipped Date], IIf(IsNull([Main Table]![Actual Shipped Date])," ",[Main Table]![Actual Shipped Date]-[Main Table]![OriginalBaseline]) AS [Difference Vs Baseline], [Main Table].[Actual Shipped Quantity], IIf(IsNull([Main Table]![Actual Shipped Quantity])," ",[Main Table]![Actual Shipped Quantity]-[Main Table]![Quantity]) AS [Difference Vs Order], [Main Table].[DC Location], [Main Table].[Ship Method], [Main Table].[Container #], [Main Table].[Authorization Date], [Main Table].[EBA Mapping]
FROM (([Main Table] LEFT JOIN [Customer List] ON [Main Table].Customer = [Customer List].Customer) LEFT JOIN ManufacturingTracking ON [Main Table].[Unique Number] = ManufacturingTracking.UniqueNumber) LEFT JOIN MacysSKUNumber ON [Main Table].MacysUnique = MacysSKUNumber.MacysUnique
WHERE ([Main Table].[Actual Shipped Date]) Is Null;


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now