I don't agree with multiple tables or multiple databases. If this was designed properly (all records in one table with a date field) then you'd only need one query. It looks to me like the sentence showing what it produces is typed here incorrectly. It has to be
SELECT FJ2021.*FROM FJ2021; but I think the lack of a space between * and FROM won't cause it to fail, which means "doesn't work" doesn't help much. I think in this case, the wanting of a table for each year is the bigger issue unless there is a good reason for it. Anyway, there is an opportunity for a vba teaching moment I suppose:
Maybe
Dim fjjar As String, strSql As String
fjjar = "FJ" & Year(Date)
strSql = "SELECT " & fjjar & ".* FROM " & fjjar & ";"
The trailing semicolon is not needed with vba sql. I suppose if you run that on January 1 you won't get much in the way of records.
Last edited by Micron; 02-22-2021 at 09:11 AM.
Reason: code correction
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.