Report from Selected Table

  • Thread starter Thread starter Jason Rhymes
  • Start date Start date
J

Jason Rhymes

I have a combo box in a form that list all the tables in the database. How
do I use a selected table for a pre made report. All the fields are set up
in the report. The thing I need it to do is to use a selected table for the
Record Source. Thanks for any help.
Jason
 
You can create a union query from all your tables like
SELECT "tblA" as TableName, *
FROM tblA
UNION ALL
SELECT "tblB", *
FROM tblB
UNION ALL
SELECT "tblC", *
FROM tblC
--etc--
Base your report on the union query and open the report with a Where Clause
like
DoCmd.OpenReport "rptYourReport", acPreview, , "TableName=""" &
Me.cboTableList & """"
 
I'm going to be adding more tables to the database on a daily bases from
Mechanical Desktop. Do I need to keep adding to the sql statement? I'll
probably add 2-3 tables per day. Right now I have over 50.
 
Check your later post with the same question. Creating new tables is a
mistake. Find a way to combine all your tables into a single table.
 
Back
Top