Try this for starters:
SELECT MANUAL_INPUT_DRILL_DATES.PLATFORM_NAME,
MANUAL_INPUT_DRILL_DATES.WELL_NAME, MANUAL_INPUT_DRILL_DATES.STATUS,
MANUAL_INPUT_DRILL_DATES.CONDUCTOR_CSG, MANUAL_INPUT_DRILL_DATES.SURF_CSG,
MANUAL_INPUT_DRILL_DATES.PROD_CSG_SET,
MANUAL_INPUT_DRILL_DATES.FIRST_GAS_TOW, MANUAL_INPUT_DRILL_DATES.RELEASE_RIG,
IIf(IsNull([MANUAL_INPUT_DRILL_DATES]![SURF_CSG])=True,"N","T") as SC
FROM MANUAL_INPUT_DRILL_DATES
WHERE MANUAL_INPUT_DRILL_DATES.FIRST_GAS_TOW > 0
ORDER BY MANUAL_INPUT_DRILL_DATES.PLATFORM_NAME,
MANUAL_INPUT_DRILL_DATES.WELL_NAME;
Your statement below has the HAVING clause checking the same field against
itself. Also that field is a Date, but you are checking it against T and N
text.
The Group By really isn't needed unless you are trying to get rid of
duplicates. A SELECT DISTINCT is cleaner if needed.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
jannie said:
SELECT MANUAL_INPUT_DRILL_DATES.PLATFORM_NAME,
MANUAL_INPUT_DRILL_DATES.WELL_NAME, MANUAL_INPUT_DRILL_DATES.STATUS,
MANUAL_INPUT_DRILL_DATES.CONDUCTOR_CSG, MANUAL_INPUT_DRILL_DATES.SURF_CSG,
MANUAL_INPUT_DRILL_DATES.PROD_CSG_SET,
MANUAL_INPUT_DRILL_DATES.FIRST_GAS_TOW, MANUAL_INPUT_DRILL_DATES.RELEASE_RIG
FROM MANUAL_INPUT_DRILL_DATES
GROUP BY MANUAL_INPUT_DRILL_DATES.PLATFORM_NAME,
MANUAL_INPUT_DRILL_DATES.WELL_NAME, MANUAL_INPUT_DRILL_DATES.STATUS,
MANUAL_INPUT_DRILL_DATES.CONDUCTOR_CSG, MANUAL_INPUT_DRILL_DATES.SURF_CSG,
MANUAL_INPUT_DRILL_DATES.PROD_CSG_SET,
MANUAL_INPUT_DRILL_DATES.FIRST_GAS_TOW, MANUAL_INPUT_DRILL_DATES.RELEASE_RIG
HAVING
(((MANUAL_INPUT_DRILL_DATES.SURF_CSG)=IIf(IsNull([MANUAL_INPUT_DRILL_DATES]![SURF_CSG])=True,"N","T")) AND ((MANUAL_INPUT_DRILL_DATES.FIRST_GAS_TOW)>0))
ORDER BY MANUAL_INPUT_DRILL_DATES.PLATFORM_NAME,
MANUAL_INPUT_DRILL_DATES.WELL_NAME;
:
Is it possible the mismatch is arising from another part of your query?
Assuming you've confirmed that's not the case, then you need to remove
everything from your query that has nothing to do with this problem,
switch to SQL View, and show us the sql statement that causes the error.
jannie wrote:
I tried exactly what you put here and I still get the data type
mismatch error?????? What do I need to check?
:
If any date is good enough, try this:
IIf(IsNull([MANUAL_INPUT_DRILL_DATES]![SURF_CSG]) = True,"N","Y")
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
:
I have several fields in my database that are date fields. The data
type in my table for these is date/time and formatted as short
date. In my query (I'll use one field as my example here). The
result I want is if there is a date in the field then say Y for
yes, or N for no. Pretty simple. I don't know why I keep getting a
data type mismatch in criteria expression error. The fields in my
table are date fields and formatted as short date. Is there
something wrong with my IIF or can you suggest a better syntax to
use. Please let me know. Thanks. Here is my formula:
IIf([MANUAL_INPUT_DRILL_DATES]![SURF_CSG]>#12/1/1900#,"Y","N"). I
also tried IIf([MANUAL_INPUT_DRILL_DATES]![SURF_CSG]>0,"Y","N").
Neither one works.
--
HTH,
Bob Barrows
.