Access list of field in a table

  • Thread starter Thread starter David Dunster
  • Start date Start date
D

David Dunster

I want to compare identical fields in two different databases. Both
databases have the same field names.

A simple compare of:

if import![field]<>export![field] then .....

will work but I would need to do this field by field compare about 20 times.

Is it possible to access the fields in a table and do a simple 'for each
.....' such as:

for each field in export
if import![field]<> export![field] then
blah
blah
end if
next each

I only have the one VB programmer's guide and I can find an example of doing
this with a form but I need the same results using a table instead of a form

Thanks much for any help.

signed

Dave, VE5DGD
 
David said:
I want to compare identical fields in two different databases. Both
databases have the same field names.

A simple compare of:

if import![field]<>export![field] then .....

will work but I would need to do this field by field compare about 20 times.

Is it possible to access the fields in a table and do a simple 'for each
....' such as:

for each field in export
if import![field]<> export![field] then
blah
blah
end if
next each

I only have the one VB programmer's guide and I can find an example of doing
this with a form but I need the same results using a table instead of a form


You are very close. Try this:

Dim fld As Field
for each fld in export.Fields
if import(fld.Name) <> fld then
blah
blah
end if
next field
 
Thanks Marshall. You lead me to where I wanted to be. I came up with a
working solution so tomorrow, when I'm wide awake, I'll carry on with the
project and reduce my code by a considerable amount.

signed,

Dave Dunster, VE5DGD
 
Back
Top