472,106 Members | 1,296 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Error 7874 using global temp table

I have a stored procedure that is loading data into a global temp table.
Here is all the code for that stored procedure.

CREATE PROCEDURE [BSO_ExportPMRecords]

AS

SET NOCOUNT ON

BEGIN

If EXISTS (Select * FROM Tempdb.dbo.sysobjects WHERE name =
"##TempPMValues")
Begin
Drop Table [##TempPMValues]
End

CREATE TABLE [##TempPMValues] (
[Monitor] [varchar] (20) NULL ,
[Coverage Area] [varchar] (20) NULL ,
[Service Co] [varchar] (20) NULL ,
[BranchSiteCode] [varchar] (20) NULL ,
[BankName] [varchar] (50) NULL ,
[BankAddress] [varchar] (50) NULL ,
[BankCity] [varchar] (30) NULL ,
[BankState] [char] (2) NULL ,
[BankZip] [varchar] (15) NULL ,
[DateInstalled] [datetime] NULL ,
[PM Type] [varchar] (15) NULL ,
[Last PM Date] [datetime] NULL ,
[Next PM Scheduled] [datetime] NULL
)

INSERT INTO ##TempPMValues SELECT * FROM PMLog ORDER BY [Coverage Area],
[Next PM Scheduled]

END
I am using DoCmd.TransferSpreadsheet to put the temp table data into a
spreadsheet. Here is that code.

DoCmd.TransferSpreadsheet acExport, 8, "##TempPMValues", sFileName

When this line executes, I see "Error 7874. Microsoft Access can't find the
object '##TempPMValues.'

I have tried both "dbo.##TempPMValues" and "tempdb.##TempPMValues" in the
TransferSpreadsheet action. I can use "Select * from ##TempPMValues" in
query analyzer and the temp table does exist.

How can I use a global temp table in TransferSpreadsheet?

Thanks,
George

Nov 12 '05 #1
0 2484

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by crazy_jutt | last post: by

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.