[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


SQLServer #TEMP table for individual users linked to Access 2010

Posted on 2011-10-26
Medium Priority
Last Modified: 2013-11-27

I have an Access 2010 routine that :
- copies from one of my main SQLServer tables all records to a 'local user' MDB (on the local users's C drive) all the records, is a temp MDB. It copies about 800 records , the table has about 20 columns, so is relatively fast copy procedure

- with that local temp MDBs table linked to the front end a user chooses, via an Access form, some or all of those records in that linked temp  table, i.e. one of the fields is a YesNo field.
- from there I use some VBA and read that list of records that linked temp  table and if a record is marked Yes I do something with that record

But I am wondering instead of using a temp MDB on the users C drive, can I somehow use a SQL Server #TEMP table and link that to the Access Front End (table ? view? USP ? ) and if so is that linked #TEMP table unique to an individual user/logon ? i.e. someone's list of YesNo records in 'their' #TEMP is not going to be overridden with someone elses list in 'their' #TEMP ? The #TEMP SQLServer table would be linked to Access 2010 and used and viewed in a form and used as  a recordset (list) in a VBA procedure

the FrontEnd interface is on a terminal server and all users log on to that and fire up the interface and use it on the TS.

thanks, a bit vague but not quite sure how to ask the quesiton on SQL #temp table, unsure of their uniqueness and duration and link-ability to Acc2010.

I have SQLServer v2008, DevEdition
Question by:LukeB
  • 3
  • 2
LVL 85

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 37030252
SQL Server Temporary tables are unique to each user/connection. From here: http://msdn.microsoft.com/en-us/library/aa258255%28SQL.80%29.aspx (Temporary Tables section, about midway through the article):

"If a local temporary table is created in a stored procedure or application that can be executed at the same time by several users, SQL Server has to be able to distinguish the tables created by the different users. SQL Server does this by internally appending a numeric suffix to each local temporary table name"

Temp tables are available throughout a single "session", which would generally be the length of your connection to the db. If you build a global connection to the server when your app starts and "kill" that connection when it ends, I would think that your temp table would be available throughout that connection session.

However, I don't think you could link a Temp table to your Access FE. I found a few forum posts that seem to support this, but the comments were somewhat vague. I've never tried to do anything like this, so don't know if you could, but it would seem to make sense that you could not link. In your case, unless you want to build an interface that works with unbound data, and use your temp table to fill local recordsets, etc you might be better off staying with your current setup.

LVL 58
ID: 37030287

  From what I'm aware, temp tables are only available within SQL itself.  I don't know of any way to link to one from Access itself.

 No points here please.


Author Comment

ID: 37054261
thanks guys, if ok by you I leave this posted this week, maybe the folk over in SQL side of EE have an idea ?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 37054267
PS: one thing I am thinking about is to have SQL 'temp' table but not a true #temp one. The table still gets filled with the same data but I add another filed with the users SQL logon id (it is a Windows logon security ). Then on the Access side in the view I just show that user their records in that temp table, and they use those. The records will get dropped and added for that user, other user record are kept.

i will let you know how that goes later in week
LVL 85
ID: 37056242
You could do that as well - whatever works best for your situation. SQL Temp tables are useful if the fulfill your needs, of course. In later versions there are also @table variables, which often serve the same purpose. However, those are very tightly scoped, so be sure to consider this if you look into @table variables.

Author Closing Comment

ID: 37091347
thanks guys, that saved me a bit of looking. Marked as 'partial complete solution' as I will have to find a workaround.

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question