Comparing field sizes via code

J

John

Hi

Is it possible to compare two tables via code and highlight identically
named fields that are different in size?

Thanks

Regards
 
A

Allen Browne

John said:
Is it possible to compare two tables via code and highlight
identically named fields that are different in size?

Not sure what you mean by "different in size."
Do you mean:
a) the field size is different e.g. Long Integer versus Integer, or Text
(50) versus Text (255)
or
b) the actual text in the field is a different length, e.g. "Dog" versus
"Dog and cat", regardless of the defined field size?

If (a), examine the Size of the Field in the TableDef. Here's an example of
how to programmatically loop through the fields of a table like that:
http://allenbrowne.com/func-06.html

If (b), create a query using the 2 tables, joined in the field.
In a fresh column in the Field row, enter
Len([T1].[F1])
substituting the table and field name from the first table.
In the Criteria row under this, enter:
<> Len([T2].[F1])
using the other table and field name.
That should handle it apart from null values.
Post back if you want details on handing that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top