Group:  Microsoft Access » microsoft.public.access.modulesdaovba.ado
Thread: Copying an Object to Another DB

Copying an Object to Another DB
LarryP 12/3/2008 1:28:05 PM
I have a process where I copy a number of tables from one database to
another. Following is the VBA for one of those tables -- it works fine:

DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
Tools\PCMetrics Tool.mdb", , acTable, "tblPCData"

Now I want to run that table through a select query in order to change some
of the field names, and copy the output of the query to the other database as
a table. I've tried several variations, but none works:

DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
Tools\PCMetrics Tool.mdb", "tblPCDataA", acTable, "qryPCDataForFE"
{{{“the CopyObject action was cancelled….”}}}

DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
Tools\PCMetrics Tool.mdb", "tblPCDataA", acQuery, "qryPCDataForFE"
{{{copies it, but as a query, not a table}}}


DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
Tools\PCMetrics Tool.mdb", "tblPCDataA", , "qryPCDataForFE"
{{{“the Object Type argument for the action or method is blank or
invalid….”}}}

Help, please?



Re: Copying an Object to Another DB
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 12/3/2008 2:08:37 PM
You cannot transfer data from a query to a table that way. You'll have to
create a MakeTable query. Note that you can have Make Table queries select
data from one database and write to another.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"LarryP" <LarryP[ at ]discussions.microsoft.com> wrote in message
news:4A833355-F0F9-4F17-B2B7-F64307323C88[ at ]microsoft.com...
[Quoted Text]
>I have a process where I copy a number of tables from one database to
> another. Following is the VBA for one of those tables -- it works fine:
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", , acTable, "tblPCData"
>
> Now I want to run that table through a select query in order to change
> some
> of the field names, and copy the output of the query to the other database
> as
> a table. I've tried several variations, but none works:
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", acTable, "qryPCDataForFE"
> {{{"the CopyObject action was cancelled.."}}}
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", acQuery, "qryPCDataForFE"
> {{{copies it, but as a query, not a table}}}
>
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", , "qryPCDataForFE"
> {{{"the Object Type argument for the action or method is blank or
> invalid.."}}}
>
> Help, please?
>
>
>


RE: Copying an Object to Another DB
LarryP 12/3/2008 5:00:01 PM
Oops, never mind. I got it to work using TransferSpreadsheet. Guess I
should have realized that copying an OBJECT is going to create that same kind
of OBJECT in the other database. Duh....

"LarryP" wrote:

[Quoted Text]
> I have a process where I copy a number of tables from one database to
> another. Following is the VBA for one of those tables -- it works fine:
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", , acTable, "tblPCData"
>
> Now I want to run that table through a select query in order to change some
> of the field names, and copy the output of the query to the other database as
> a table. I've tried several variations, but none works:
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", acTable, "qryPCDataForFE"
> {{{“the CopyObject action was cancelled….”}}}
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", acQuery, "qryPCDataForFE"
> {{{copies it, but as a query, not a table}}}
>
>
> DoCmd.CopyObject "\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\MSAccess
> Tools\PCMetrics Tool.mdb", "tblPCDataA", , "qryPCDataForFE"
> {{{“the Object Type argument for the action or method is blank or
> invalid….”}}}
>
> Help, please?
>
>
>

Home | Search | Terms | Imprint
Newsgroups Reader