473,383 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Temp Table in Stored Procedure with Access Report

I have read the newsgroups and see this is a common issue but I saw no
resolution for it:
I have an Access2K frotn end and SQL Server 2K backend.
In access, I create a temp table using code in a module:
strSQL = "CREATE TABLE #tempTableName ("TempID int NOT NULL IDENTITIY
(1,1) PRIMARY KEY, Field1 int...)
CurrentProject.Connection.Execute strSQL,,adCmdText

so far so good...

I create a stored procedure that uses the temp table table above in
the FROM statement to populate a form, where myStoredProcedureName is
the recordsource for the form.

The recordset is editable.
so far so good...

I double-click on the stored procedure by itself, just to check the
table exists.
so far so good...

I create a report based on the same stored procedure.
I get "Invalid object name '#tempTableName'.

So, I double-click on the stored procedure by itself, to see if the
temp table has evaporated, it opens fine.

For whatever reason, Access dowsn't like to use the temp table in a
report's recordsource, even if it's called in a stored procedure???

I would like to use a temp table rather than a persistent global table
used to hold temp data for these reports. Can this be done?
lq
Nov 12 '05 #1
1 3658
I may be off course here, but is the temp table linked to your Access
project? Is your report trying to use a local table which exists on the
server, not locally?
If you are avoiding using linked tables, you should probably establish
the record source for the report in code when it is being opened, using
your server connection.
Pavel

Lauren Quantrell wrote:

I have read the newsgroups and see this is a common issue but I saw no
resolution for it:
I have an Access2K frotn end and SQL Server 2K backend.
In access, I create a temp table using code in a module:
strSQL = "CREATE TABLE #tempTableName ("TempID int NOT NULL IDENTITIY
(1,1) PRIMARY KEY, Field1 int...)
CurrentProject.Connection.Execute strSQL,,adCmdText

so far so good...

I create a stored procedure that uses the temp table table above in
the FROM statement to populate a form, where myStoredProcedureName is
the recordsource for the form.

The recordset is editable.
so far so good...

I double-click on the stored procedure by itself, just to check the
table exists.
so far so good...

I create a report based on the same stored procedure.
I get "Invalid object name '#tempTableName'.

So, I double-click on the stored procedure by itself, to see if the
temp table has evaporated, it opens fine.

For whatever reason, Access dowsn't like to use the temp table in a
report's recordsource, even if it's called in a stored procedure???

I would like to use a temp table rather than a persistent global table
used to hold temp data for these reports. Can this be done?
lq

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: snoopy13 | last post by:
I am using crystal report.NET in my asp.net application. I have a report calling a stored procedure from SQL Server 2000. Whenever I am using temp tables in the stored procedure, I am getting...
17
by: Jon Ole Hedne | last post by:
I have worked on this problem some hours now (read many-many...), and I can't solve it: In vba-code I create a table with Connection.Execute, and add some data to it. This table is saved in the...
0
by: Lauren Quantrell | last post by:
I have read the newsgroups and see this is a common issue but I saw no resolution for it: I have an Access2K frotn end and SQL Server 2K backend. In access, I create a temp table using code in a...
1
by: BigD | last post by:
This all centers around an Access Data Project I have a stored procedure that aggregates events stored in a table based on intervals I specify. I have a form that supplies parameters for the...
2
by: Lauren Quantrell | last post by:
I am using a stored procedure as the recordsource on an MS-Access2000 form: Forms!frmName.RecordSource = "dbo.myStoredProcedure" The stored procedure creates a temp table #Contacts and then...
1
by: hotice3100 | last post by:
I have created an interface for a SQL Reporting Service report. SQL Reporting Service makes a virutal directly in IIS called ReportServer. There are various buttons on the form I created and one...
4
by: joshd | last post by:
can anyone help me figure out why when i run the following stored procedure i get the error: (1460 row(s) affected) Msg 245, Level 16, State 1, Procedure SP_SALESTRENDS, Line 40 Conversion...
2
by: kizmar | last post by:
You'll have to excuse me as I'm familiar with T-SQL (SQL Server), not so much DB2 when creating stored procedures... I'm trying to create a procedure where I build multiple temp tables (DECLARE...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.