473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Run time error 13 Type mismatch

I've been given an Access DB for debugging. When running a query for a report the code stops with "Run time error 13 Type mismach".

The code is stopping on the Else clause c = FormatDateTime(Month(bd) & "/" & Day(bd) & "/" & Year(ed))


Expand|Select|Wrap|Line Numbers
  1. Function GetAge(bd, sd, ed) As Integer
  2. Dim a, c, d
  3. GetAge = 0
  4. If IsNull(bd) Or IsEmpty(bd) Or IsNull(sd) Or IsEmpty(sd) Or IsNull(ed) Or IsEmpty(ed) Then
  5.     Exit Function
  6. Else
  7.     If Month(bd) >= Month(sd) Then
  8.         'd = DateSerial(Year(sd), Month(bd), Day(bd)) - DateSerial(Year(bd), Month(bd), Day(bd))
  9.         c = FormatDateTime(Month(bd) & "/" & Day(bd) & "/" & Year(sd))
  10.     Else
  11.         'd = DateSerial(Year(ed), Month(bd), Day(bd)) - DateSerial(Year(bd), Month(bd), Day(bd))
  12.         c = FormatDateTime(Month(bd) & "/" & Day(bd) & "/" & Year(ed))
  13.     End If
  14. End If
  15. a = DateDiff("yyyy", bd, c)
  16. 'MsgBox a & vbNewLine & d / 365
  17. GetAge = a
  18. End Function

Thank you in advance for your insight.
Apr 3 '07 #1
5 5705
Rabbit
12,516 Expert Mod 8TB
A type mismatch indicates that a variable is expecting a certain data type but receiving a different data type. So you'll want to check that you're passing the correct data types to functions and assigning the correct data types to variables.
Apr 3 '07 #2
NeoPa
32,556 Expert Mod 16PB
Check the values in [bd] & [ed]. They both need to be dates.
The line looks strange anyway - Does it need to refer to both fields or should they all be references to [bd]?
Apr 4 '07 #3
i am just install EventTracker 6 and when i am starting the monitiring this message appear please tell me the answer
Jul 29 '08 #4
NeoPa
32,556 Expert Mod 16PB
You have asked your question in another member's thread. This is called thread hijacking and is not allowed on this site. There are various reasons for this, the principal of which is that it typically diverts the flow of the thread away from their needs and into yours. Another is that it will tend to mean that your new question is not seen as such, and may get overlooked by many of our experts (You appreciate that they're not looking for answered questions).
Please post your questions in their own threads in future (See How to Ask a Question).

ADMIN.
Jul 29 '08 #5
NeoPa
32,556 Expert Mod 16PB
If you do decide to post this question properly, please remember to provide some actual information. As it stands it makes no sense and is almost impossible to respond to anyway.
Jul 29 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't...
2
by: Steve Briley | last post by:
I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error".  Here's an example table that I'm working with... ...
5
by: Mike | last post by:
I am trying to use the bulk insert command but I am getting the following error: ---Begin Error Msg--- Server: Msg 4867, Level 16, State 1, Line 1 Bulk insert data conversion error (overflow)...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
0
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query...
1
by: ArcadeJr | last post by:
Good morning all! I have been getting a Run-time Error message #3464 - Data Type mismatch in criteria expression. While trying to run a query. I have a database where the field Asset_Number...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
9
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine...
4
by: JFKJr | last post by:
Hello everyone, the following code is working fine for the first time when I run it and giving "Run-time error '13': Type mismatch" at line #15 during the second time and so on.... The code is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.