I am trying to check a field in a table to see if the field exist or not. If the table does NOT exist then I plan to add it to the table.
I have code that works to append the field to the table but I don't know how to first check the table for the field. =(
I am using Visual Basic 6 and my database is MS Access 2000.
I know my code should look something like this:
************CODE*********************
Dim tdf As TableDef
Dim fld As Field
if <<check to see if DOP (field) is in table (Table_Item_Details) then
' Field NOT in table so appened the table
With gDBS
Set tdf = .TableDefs("Table_Item_Details")
tdf.Fields.Append tdf.CreateField("DOP", dbDate)
End With
End If
************CODE END*******************
Note that gBDS is defined elsewhere in my code. It is a global variable defined as a Database. DOP = Date of Purchase.
Any help anyone can provide would be appreciated. I have looked all over the
VB help files and can not seem to find a way to check this.