Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why are the new tables invisible ? 2

Status
Not open for further replies.

Danyul

Technical User
Jul 5, 2001
36
AU
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
 
this might help a little


CurrentDb.TableDefs.refresh
after your last line


regards

jo
 
Jo,

Thanks for the help.

I gave it a go and it seems to work most of the time but occasionally I have to open and close one of the other tables on the tab to get it to refresh. Any ideas ?

Thanks again.

Dan
 

I have found DoEvents a nice one

it makes the darned thing complete the last thing it was doing before going on - a good one to remember when your vying for processor order

regards

Jo

hope this helps
 
If it's just the database window that's not updating try:

application.refreshdatabasewindow

HTH
pjm

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top