[AccessD] Strange Error 13 Type Mismatch error

Gustav Brock gustav at cactus.dk
Tue Oct 21 11:04:35 CDT 2014


Hi Doug

Or try this modification:

Dim strIARed As String
strIARed = Me.IARed.Value
If strIARed = "Red" Then

/gustav

-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] På vegne af Jim Dettman
Sendt: 21. oktober 2014 18:03
Til: 'Access Developers discussion and problem solving'
Emne: Re: [AccessD] Strange Error 13 Type Mismatch error


 It's telling you it's not a string.

 2010 tightened down on a lot of things, like syntax and data typing, so some things you could get away with in the past, you can no longer.

 I'd start first by looking at how you place the value in the control.  Make it either a literal, or do the CSTR() on the way in.

 The other thing I'd do is rename the control.  Right now, it looks like the control and field have the same name.  That's never a good idea.

Jim.
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Murphy
Sent: Tuesday, October 21, 2014 11:51 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Strange Error 13 Type Mismatch error

Hi Gustav,

Yes, since this was originally created in Access 98 that was the way it originally was and other similar procedures in the routine still are. I just changed to period to see if that had any impact on the issue.  It didn't.
Both structures behave the same. 

IRed is the name of a text box that holds either "black" or "red". This controls the way a portion of the report displays. If I check the value of the text box in the Immediate  window it returns the correct value with no error. 

This report is for dog pedigrees and shows the dogs family tree back for 6 generations if the data is available.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, October 21, 2014 1:04 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Strange Error 13 Type Mismatch error

Hi Doug

Have you tried using a bang: 

   Me!IARed

Or:

    If Me!IARed.Value = "Red"

What does

?  Me.IARed

return?

/gustav

-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] På vegne af Doug Murphy
Sendt: 21. oktober 2014 02:07
Til: 'Access Developers discussion and problem solving'
Emne: [AccessD] Strange Error 13 Type Mismatch error

Folks,

Ran into an interesting issue in moving an application to Access 2010. The application that was originally developed in Access 98. Moved to Access 2003 and it ran fine. Moved to Access 2007 and it ran fine. In Access 2010, after fixing references etc, when we attempt to run a report that has some code behind that sets formatting we get the "Error 13, Type Mismatch" message.
The line that throws this error is ' If Me.IARed = "Red" Then' where IARed is a hidden text box holding a text value of red or black. When I put Me.IARed in the immediate window it returns the value in the text box. When I put Me.IARed = "Red" in the immediate window I get the error. When I change the line to ' If CStr(Me.IARed) = "Red" Then' it works.

Any idea what is happening here? As I said this worked well in previous versions and I do this all the time in other applications. I did decompile the application and compile, then compact several times. The application compiled with the original code, but would error when running.

Doug 



More information about the AccessD mailing list