PC Review


Reply
 
 
bsc gmcc
Guest
Posts: n/a
 
      9th Feb 2009
I am receiving Error 13, Type Mismatch on the following Dmax statement. I
know that Year([Date_Received]) brings back the year when I run it in a query
and that CInt(Year(Forms!Complaint!txtDateReceived))) returns the year as
well. I may not need some of functions such as CInt but I have been playing
with this to see why the error is occuring with no luck.


lngComplaintID = DMax("[StateSeq]", "Complaint", _
"[State_ID] = " & Forms!Complaint!State_ID And "Year([Date_Received]) =
" & CInt(Year(Forms!Complaint!txtDateReceived))) _
+ 1

--
bsc
 
Reply With Quote
 
 
 
 
bsc gmcc
Guest
Posts: n/a
 
      9th Feb 2009
Sorry, this is a duplicate. It said my orginal post didn't get sent because
of some error but obviously that wasn't true. I can't figure out how to
delete this one.
--
bscgmcc


"bsc gmcc" wrote:

> I am receiving Error 13, Type Mismatch on the following Dmax statement. I
> know that Year([Date_Received]) brings back the year when I run it in a query
> and that CInt(Year(Forms!Complaint!txtDateReceived))) returns the year as
> well. I may not need some of functions such as CInt but I have been playing
> with this to see why the error is occuring with no luck.
>
>
> lngComplaintID = DMax("[StateSeq]", "Complaint", _
> "[State_ID] = " & Forms!Complaint!State_ID And "Year([Date_Received]) =
> " & CInt(Year(Forms!Complaint!txtDateReceived))) _
> + 1
>
> --
> bsc

 
Reply With Quote
 
David H
Guest
Posts: n/a
 
      9th Feb 2009
I think you need single apostrophes around the State_ID bit as in ...

lngComplaintID = DMax("[StateSeq]", "Complaint", _
"[State_ID] = " & "'" & Forms!Complaint!State_ID & "'" & And
"Year([Date_Received]) =
" & CInt(Year(Forms!Complaint!txtDateReceived))) _
+ 1

I separated them out for clarity.

Typically if you get a Type Mismatch error it means that Access is expecting
one data type but you supplied another. In this instance, I would GUESS that
the State_ID is actually a string value, however as originally written you
supplied as if it was numeric.

I'm assuming that State_Id is comprised of alphanumeric characters?

"bsc gmcc" wrote:

> I am receiving Error 13, Type Mismatch on the following Dmax statement. I
> know that Year([Date_Received]) brings back the year when I run it in a query
> and that CInt(Year(Forms!Complaint!txtDateReceived))) returns the year as
> well. I may not need some of functions such as CInt but I have been playing
> with this to see why the error is occuring with no luck.
>
>
> lngComplaintID = DMax("[StateSeq]", "Complaint", _
> "[State_ID] = " & Forms!Complaint!State_ID And "Year([Date_Received]) =
> " & CInt(Year(Forms!Complaint!txtDateReceived))) _
> + 1
>
> --
> bsc

 
Reply With Quote
 
David H
Guest
Posts: n/a
 
      9th Feb 2009
I think you need single apostrophes around the State_ID bit as in ...

lngComplaintID = DMax("[StateSeq]", "Complaint", _
"[State_ID] = " & "'" & Forms!Complaint!State_ID & "'" & And
"Year([Date_Received]) =
" & CInt(Year(Forms!Complaint!txtDateReceived))) _
+ 1

I separated them out for clarity.

Typically if you get a Type Mismatch error it means that Access is expecting
one data type but you supplied another. In this instance, I would GUESS that
the State_ID is actually a string value, however as originally written you
supplied as if it was numeric.

I'm assuming that State_Id is comprised of alphanumeric characters?


"bsc gmcc" wrote:

> I am receiving Error 13, Type Mismatch on the following Dmax statement. I
> know that Year([Date_Received]) brings back the year when I run it in a query
> and that CInt(Year(Forms!Complaint!txtDateReceived))) returns the year as
> well. I may not need some of functions such as CInt but I have been playing
> with this to see why the error is occuring with no luck.
>
>
> lngComplaintID = DMax("[StateSeq]", "Complaint", _
> "[State_ID] = " & Forms!Complaint!State_ID And "Year([Date_Received]) =
> " & CInt(Year(Forms!Complaint!txtDateReceived))) _
> + 1
>
> --
> bsc

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time error when trying to use DMax on a line value Jim Brooks Microsoft Access Forms 6 4th Jan 2008 11:32 AM
DMax for dates in rpt group header returns DMax for entire records =?Utf-8?B?aGVsaW9z?= Microsoft Access Getting Started 1 19th Jul 2005 09:32 PM
Error from DMAX in VBA =?Utf-8?B?TWF1aSBvbiBteSBtaW5k?= Microsoft Access VBA Modules 2 4th Nov 2004 10:03 PM
Error Message on DMax +1 Tina Microsoft Access Forms 1 11th Feb 2004 02:40 AM
Error in Dmax Function Kevin Microsoft Access Form Coding 2 22nd Jan 2004 02:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:47 PM.