Hi all,
I am using the folowing code within a do..while loop to create tables named tblreport1monthago to tblreport6monthago.
The problem is that when I run the code stepwise to debug it the new tables don't show up on the database 'tables' tab.
If I run the code a second time I get error messages when I try to recreate the tables telling me they already exist. So why can't I see them ?
Set tdfnew = CurrentDb.CreateTableDef("tblreport" & monthago & "monthago"
With tdfnew
Set fldDef = .CreateField("TransactionNO", dbLong)
'fldDef.Attributes = dbAutoIncrField 'Make it an autonumber
.Fields.Append fldDef
Set fldDef = .CreateField("Value", dbLong)
.Fields.Append fldDef
Set fldDef = .CreateField("Method", dbLong)
fldDef.Attributes = dbAutoIncrField 'Make it an autonumber
.Fields.Append fldDef
Set fldDef = .CreateField("Date", dbDate)
.Fields.Append fldDef
Set fldDef = .CreateField("Catagory", dbText)
.Fields.Append fldDef
End With
'Add definition to Tabledefs collection
CurrentDb.TableDefs.Append tdfnew
Any help much appreciated.
Regards
Dan
I am using the folowing code within a do..while loop to create tables named tblreport1monthago to tblreport6monthago.
The problem is that when I run the code stepwise to debug it the new tables don't show up on the database 'tables' tab.
If I run the code a second time I get error messages when I try to recreate the tables telling me they already exist. So why can't I see them ?
Set tdfnew = CurrentDb.CreateTableDef("tblreport" & monthago & "monthago"
With tdfnew
Set fldDef = .CreateField("TransactionNO", dbLong)
'fldDef.Attributes = dbAutoIncrField 'Make it an autonumber
.Fields.Append fldDef
Set fldDef = .CreateField("Value", dbLong)
.Fields.Append fldDef
Set fldDef = .CreateField("Method", dbLong)
fldDef.Attributes = dbAutoIncrField 'Make it an autonumber
.Fields.Append fldDef
Set fldDef = .CreateField("Date", dbDate)
.Fields.Append fldDef
Set fldDef = .CreateField("Catagory", dbText)
.Fields.Append fldDef
End With
'Add definition to Tabledefs collection
CurrentDb.TableDefs.Append tdfnew
Any help much appreciated.
Regards
Dan