I agree with those who say you should combine the tables with an ID of their
origin to keep them identifiable. That said you could use code similar to
that below to pick the table to query.
__________________________________________________ ___
Sub setquery()
Dim Db As Database
Dim RS As Recordset
Dim qry As QueryDef
Dim strQryFirstpart As String
Dim strQryWhole As String
Dim strTable As String
Dim strQuote As String
Dim strTableName As String
Set Db = CurrentDb
strQryFirstpart = "Select * from "
strTableName = WhichTable()
strQryWhole = strQryFirstpart & strTableName
Set qry = Db.CreateQueryDef("", strQryWhole)
Set RS = qry.OpenRecordset()
End Sub
Function WhichTable()
Dim strhandback As String
strhandback = InputBox("Which table do you want?", "Table to Query?",
"")
WhichTable = strhandback
End Function
__________________________________________________ ____________
"laurentc" <laurent.crouzet@gmail.comwrote in message
news:1157990678.283288.21940@i42g2000cwa.googlegro ups.com...
Quote:
Dear all,
>
I have several tables based on exactly the same fields
(Key/Date/Price1/Price2).
I do some statistics on the prices.
>