Create Field with all the properties base from a table.

  • Thread starter Benjamins via AccessMonster.com
  • Start date
B

Benjamins via AccessMonster.com

Hi,

I have 2 backend database, DB1 and DB2. DB1 is the current database used
while DB2 is used for testing.

I have a table call StudentRecord for both table. Recently we had add a new
field into the DB2 call WithdrawDate.

I have a code entered into the frontend system that it will check DB2 and
update any missing field into DB1 The code is as below

CheckExist_Field is a function to check whether the field exist in the table
tdf2 refer to the field name for DB2. tbl1 refer to the table in DB1

Dim fld1 as Field
If CheckExist_Field(tdf2.Name, tbl1) = False Then
Set fld1 = tbl1.CreateField(tdf2.Name, tdf2.Type, tdf2.Size)
fld1.Attributes = tdf2.Attributes
 
K

kc-mass

Seems fine.
The other option would be (depending on your data needs) to create DB2 anew
with a make table query sourced from DB1.

Regards

Kevin
 
Top