Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 15th, 2008, 10:31 AM
Authorized User
Join Date: Feb 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating tables on the fly

I have a database, where I create tables dynamically in code. These tables are temporary tables for which their size and fields are only known at runtime. I have no problem creating a table using the TableDef, Field and Index objects, however when I append the table to the database using CurrentDb.TableDefs.Append MyTable, the table does not appear in the list of tables in the left pane, even after having called CurrentDb.TableDefs.Refresh. The only way I can see it is to close and re-open the database.

When these tables are created, there is a lot of processing going on, so is it an Application level event that hasn't been able to fire? Will a strategically placed DoEvents do the job, or is it something else?

Many thanks for any help!

Old January 15th, 2008, 10:49 AM
Authorized User
Join Date: Feb 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts

I *may* have figured this out. Calling the Application level method, RefreshDatabaseWindow, seemed to do the trick, although the table didn't appear until after execution had finished, rather than when the method was called, which is fine. I'm not putting my hopes on it always working though.

Can anyone confirm this was the right thing to do?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a DTS package on the fly in C# dramz C# 0 July 18th, 2007 01:04 PM
creating textfield on the fly Acod Classic ASP Professional 1 April 25th, 2007 09:22 AM
creating controls on the fly mtrtxs Access 9 September 10th, 2004 04:51 AM
Creating htmls on the fly... merguvan Classic ASP Basics 5 January 31st, 2004 03:31 PM
Creating form controls on the fly roniestein Access 6 December 23rd, 2003 01:30 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.