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!

How to select table(s) for export in VBA module

Status
Not open for further replies.

TrollBro

Technical User
Sep 4, 2004
98
US
Hello

I have a module in a A.mdb to auto create a new B.mdb and then export a table from the A,mdb to the B.mbd. It works fine with a hard coded table name. I'm trying to figure out how to have a list, populated with tables names from A.mdb, pop up for the user to select the table(s) that should be exported. Is there an easy way to do this?

Thanks!
 
How are ya TrollBro . . .

Start the listbox wizard. When the wizard comes up click cancel. In the Row Source property of the listbox copy/paste the following:
Code:
[blue]SELECT Name FROM MSysObjects WHERE (Type=1);[/blue]
Then set the following properties:

Column Count [blue]1[/blue]
Column Heads [blue]No[/blue]
Column Width [blue]1"[/blue]
Multi Select [blue]Extended[/blue]

Thats it ...




Then set the following properties.



See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Actually, you might want to exclude the system tables which begin with "msys":
Code:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Name Not Like "msys*" AND MSysObjects.Type=1;

Duane
Hook'D on Access
MS Access MVP
 
The AcemAn1 and dhookom

Thanks for your suggestions.

I couldn't quite figure out how to use your replies - it took me a few days, but now that I think of it, I should create a form with this MsysObjects table as the data source and call the form. right?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top