View Full Version : Leading zeros in a field


lp4799
01-08-2002, 01:21 PM
I have to work with two tables to run a query. The first table has a field titled QUAL_TRK_NO, but the way the data appears in the field is as follows: 00000000000000000000000000000002721897
(leading zeros)

The second table has a field titled KEY_INFO. This field contains the same data as the QUAL_TRK_NO, but the data appears in the following format: 2721897.

(It's the same number, but in a without the leading zeros)

Right now, if I join the tables and run a query, there is no data returned. I need to prepare a query using the two tables to retrieve other data from the tables, but this field is the one field that the two tables have in common.

The tables I use are on a network, so I don't maintain the data. How can I get both of the fields to match up and allow the query to run?

Please help! Thanks.

jwindon
01-08-2002, 03:31 PM
Use in your query the RIGHT function. (more information is available from the HELP files)


=Right([fieldname],7)

Hope that helps. Good luck to you.

Pat Hartman
01-08-2002, 06:25 PM
If the length of the significant digits is not always the same, you can convert both fields to long integers using the CLng() function.