Is there a way to change the SQL database named in the FROM statement, and if so, how? Sometimes there is a need to query a different SQL 2008 database and rather than change each query individually, it would be very helpful if a parameter could be used
from a form or some other means.
This works in the query - FROM [TheDB].[dbo].tblname
I tried using a control on a form, because sometimes the query needs to look at a different/backup database, but keep getting error 102.
This does not work in the query - FROM [Forms]![frmStartup]![dbLocation].[dbo].tblname
I also tried with parenthises as: ([Forms]![frmStartup]![dbLocation]).[dbo].tblname
It is confusing because you can refer to a control on a form in the WHERE clause and it works.
Any suggestions would be greatly appreciated.
I should also say that I am using Access 2000 on a WindowsXP machine and have many pass-thru queries that work just fine, but in order to look at a different/backup SQL server it is necessary to change each query individually.
Thanks very much.