View Full Version : Data Type Mismatch?


ewong1
01-23-2008, 09:29 AM
I am querying results using Access 97(Yes its old and no my company is not willing to upgrade.....:confused:). Anyhow, I am connecting to a corporate database that has two tables I am querying that should be joined on one field (wmg.wmgtk01_tnk.sys_i = wmg.wmgwo04_halfleg_actl.tnk_sys_i). I am running into a problem with these fields because they have been defined differently by my IT department. The "sys_i" field is a NUMBER of length 5, while the "tnk_sys_i" field is a NUMBER of length 20. Is there a way that I can trick Access into joining these fields even though they do not match? I am currently getting a "Data Type Mismatch" error when I attempt to create this join.

Thanks in advance for your help!

WayneRyan
01-23-2008, 09:38 PM
ewong1,

You can wrap both fields in a CLng function:

CLng(wmg.wmgtk01_tnk.sys_i) = CLng(wmg.wmgwo04_halfleg_actl.tnk_sys_i)

Wayne

neileg
01-24-2008, 04:06 AM
??

So long as they are both numbers, I don't understand why this throws a data type mismatch.

ewong1
01-24-2008, 07:09 AM
that worked beautifully! thanks!