Merge Tables Access 97

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Is is possible to merge some 100 small tables into one
table, without having to create one make table query, and
then appending all the others in an append query.

The tables al be gin with the same word OUTFUT then a
date, so it would be good if it was possible to do it in
code like outfut* ......hope this makes sense...and I
could just be being lazy! but since I will have to do
this often it would be good if I could somehow automate
the procedure.

Cheers

PS I have the below code that someone gave me, but it
isn't working, perhaps because of the version I am using:

Sub Append_Tables()
 
The code looks good. Did you create a table named 'Target
Table Name' before you ran the code? What error are you
getting?

-----Original Message-----
Is is possible to merge some 100 small tables into one
table, without having to create one make table query, and
then appending all the others in an append query.

The tables al be gin with the same word OUTFUT then a
date, so it would be good if it was possible to do it in
code like outfut* ......hope this makes sense...and I
could just be being lazy! but since I will have to do
this often it would be good if I could somehow automate
the procedure.

Cheers

PS I have the below code that someone gave me, but it
isn't working, perhaps because of the version I am using:

Sub Append_Tables()
TargetTable = "Target Table Name"
For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 6) = "OUTFUT" Then
SourceTable = tbl.Name
strSQL = "INSERT INTO [" & TargetTable & "]"
strSQL = strSQL & " SELECT " & SourceTable & ".*"
strSQL = strSQL & " FROM " & SourceTable
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End If
Next
End Sub
.
 
Back
Top