303factory
08-25-2009, 02:48 AM
Hi
I need to be able to vary the connection string in a query depending on who is logged in (I'm using SQL Server 2005 back end to my access client).
I have a function getConnectionString which generates teh connection string depending on the logged in user and the required database, but I'm not sure how to code this into the query. I tried setting the connection string property to 'getConnectionString("myDatabase")' but when you try to open the query it says 'not a valid file name'
the query code is as such:
[code]SELECT tblStaff.ID, tblStaff.UserID
FROM tblStaff IN '' [getConnectionString("MIDSQLKB")]
ORDER BY tblStaff.UserID;
Any ideas what I'm doing wrong here?
thanks
303
I need to be able to vary the connection string in a query depending on who is logged in (I'm using SQL Server 2005 back end to my access client).
I have a function getConnectionString which generates teh connection string depending on the logged in user and the required database, but I'm not sure how to code this into the query. I tried setting the connection string property to 'getConnectionString("myDatabase")' but when you try to open the query it says 'not a valid file name'
the query code is as such:
[code]SELECT tblStaff.ID, tblStaff.UserID
FROM tblStaff IN '' [getConnectionString("MIDSQLKB")]
ORDER BY tblStaff.UserID;
Any ideas what I'm doing wrong here?
thanks
303