Kamis, 10 Mei 2012

RE: [MS_AccessPros] Data type mismatch

 

Diane-

Hmmm. The only place it could get a data type mismatch in in the WHERE clause.
Is the Date field a Date/Time data type? Also, Date is a reserved word that you
shouldn't ever use as a field name. If this came directly from the Query
Design, I'm surprised that Access didn't wrap [] around the field name so that
it's not confused with the Date function. You could try this (providing Date
is, in fact, Date/Time):

SELECT [2012 FIRE/RESCUE CALLS].[RUN NUMBER], [2012 FIRE/RESCUE CALLS].SUB,
[2012 FIRE/RESCUE CALLS].[Date], [2012 FIRE/RESCUE CALLS].Time,
[2012 FIRE/RESCUE CALLS].NAME, [2012 FIRE/RESCUE CALLS].ADDRESS,
[2012 FIRE/RESCUE CALLS].APT, [2012 FIRE/RESCUE CALLS].AREA,
[2012 FIRE/RESCUE CALLS].[EXT?], [2012 FIRE/RESCUE CALLS].TYPE,
[2012 FIRE/RESCUE CALLS].ALS, [2012 FIRE/RESCUE CALLS].BLS,
[2012 FIRE/RESCUE CALLS].DESTINATION, [2012 FIRE/RESCUE CALLS].STANDBYS,
[2012 FIRE/RESCUE CALLS].[UNITS RESPONDING], [2012 FIRE/RESCUE CALLS].[MA
GIVEN],
[2012 FIRE/RESCUE CALLS].[MA REC'D], [2012 FIRE/RESCUE CALLS].[MA REC'D FROM]
FROM [2012 FIRE/RESCUE CALLS]
WHERE ((([2012 FIRE/RESCUE CALLS].[Date])>#3/31/2012# And
([2012 FIRE/RESCUE CALLS].[Date])<#5/1/2012#))
ORDER BY [2012 FIRE/RESCUE CALLS].[RUN NUMBER],
[2012 FIRE/RESCUE CALLS].SUB;

Copy and paste that into the SQL window of a new query. Watch out for crazy
line wrapping in my reply!

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-------------------------------------

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Diane
Sent: Thursday, May 10, 2012 6:10 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Data type mismatch

 
Is below what you are looking for?

SELECT [2012 FIRE/RESCUE CALLS].[RUN NUMBER], [2012 FIRE/RESCUE CALLS].SUB,
[2012 FIRE/RESCUE CALLS].Date, [2012 FIRE/RESCUE CALLS].Time, [2012 FIRE/RESCUE
CALLS].NAME, [2012 FIRE/RESCUE CALLS].ADDRESS, [2012 FIRE/RESCUE CALLS].APT,
[2012 FIRE/RESCUE CALLS].AREA, [2012 FIRE/RESCUE CALLS].[EXT?], [2012
FIRE/RESCUE CALLS].TYPE, [2012 FIRE/RESCUE CALLS].ALS, [2012 FIRE/RESCUE
CALLS].BLS, [2012 FIRE/RESCUE CALLS].DESTINATION, [2012 FIRE/RESCUE
CALLS].STANDBYS, [2012 FIRE/RESCUE CALLS].[UNITS RESPONDING], [2012 FIRE/RESCUE
CALLS].[MA GIVEN], [2012 FIRE/RESCUE CALLS].[MA REC'D], [2012 FIRE/RESCUE
CALLS].[MA REC'D FROM]
FROM [2012 FIRE/RESCUE CALLS]
WHERE ((([2012 FIRE/RESCUE CALLS].Date)>#3/31/2012# And ([2012 FIRE/RESCUE
CALLS].Date)<#5/1/2012#))
ORDER BY [2012 FIRE/RESCUE CALLS].[RUN NUMBER], [2012 FIRE/RESCUE CALLS].SUB;

--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...> wrote:
>
> Diane-
>
> Switch to SQL View of your query and copy and paste the text. That will be
much
> easier for us to debug.
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
> -------------------------------
>
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Diane
> Sent: Wednesday, May 09, 2012 6:56 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Data type mismatch
>
>  
> I am trying to count how many times a category has some information in it such
> as a TYPE column that has an M or F in it, I want to know how many times M or
F
> showed up. I keep getting a "Data type mismatch in criteria expression" error.
I
> don't know how to correct this. I am not very knowledgeable of expressions.
Any
> help would be appreciated. Thanks.
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar