|
-
September 29th, 2001, 08:12 AM
#1
Updating database
Please help! I am a beginner with VB and need to update a DAO/Access 97 table with the old table data. The problem is that the new table has extra fields that's not in the old table.
How can i check each field from the new table to see if the same field exist in the old table so that i can import the data if it exist or add a default value if the field does not exist.
Any help please, i'm desperate!!!
Wynand
-
September 30th, 2001, 04:16 PM
#2
Re: Updating database
A recordset has a fields collection, contining field objects. This way, you can do the check.
Dim fldNew as Field
Dim fldOld as Field
on error resume next ' disable errorhandling
for Each fldNew In rstNew
set fldOld = rstOld.Fields(fldNew.Name)
If Err.Number <> 0 then
' Field doesn't exist in old recordset
else
' Field exist in old recordset
End If
next fldNew
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|