Paste records

KenHigg

Registered User
Local time
Today, 17:32
Joined
Jun 9, 2004
Messages
13,291
In Hyperion I'm using JOOLE application object to copy records to the clipboard and then paste them into an Access table. I can do it manually (the paste part) and using code I can even get the data to the clipboard but when I use:

Application.DoCmd.OpenTable("Table1")

to open the table it will not paste with:

Application.RunCommand(acCmdPasteAppend)

It appears to be because the entire row in the table is not selected. I tried to find something to select the row or all rows but can't get anything to work - Any ideas?
 
The record layouts of your Copy From and Copy To tables would need to match, but if they didn't you would be getting an error message, which you didn't mention. Something might be happening that causes your paste buffer to be lost.

I experimented by opening an Acces table, selecting a record, and doing a Copy. I then closed the table and in the Immediate pane of VBA, executed the two commands you listed, and it worked perfectly. You might try some similar experiments.
 
Last edited:
Thanks for the reply. I couldn't figure out how to paste from the Hyperion (JOOLE) side but I could get a vba macro to fire so I use it to call the following code in VBA on the database side:

Code:
Public Function fncPasteData()

    DoCmd.OpenTable ("Table1")
    RunCommand (acCmdSelectAllRecords)
    SendKeys "^v", False
    SendKeys "{enter}", False

End Function

Here's the javascript/JOOLE code from Hyperion:

Code:
// Copy results to clipboard
	ActiveDocument.Sections["Open_ETOPS_all R"].Copy();
	DoEvents();

// Create Access object
	oAccess = new JOOLEObject("Access.Application");
	DoEvents();

// Display Access object
	oAccess.Visible = true;
	DoEvents();

// Open database
	oAccess.Application.OpenCurrentDatabase("C:\\Documents and Settings\\340364\\Desktop\\Database1.mdb");
	DoEvents();

// Run Access macro that pastes clipboard data
	oAccess.Application.DoCmd.RunMacro("mcrPasteData");
	DoEvents();

// Close Access
	oAccess.application.CloseCurrentDatabase;
	oAccess.Quit();
	oAccess = null;

Alert ("Done!");

So now when the report is due you click a button in Hyperion and the new data is pasted into Access where it's much easier to transform/automate into something useful...
 

Users who are viewing this thread

Back
Top Bottom