Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CopyObject Cancelled in Access 97 to 2000 conversion

Posted on 2001-09-03
11
Medium Priority
?
270 Views
Last Modified: 2012-06-27
I have a bit of code that creates a copy of a module in a remote database. It works with no problems in Access 97.
The basic code is

dim app as access.application
set app= new access.application
app.opencurrentdatabase Filename
app.docmd.copyobject ,"newModuleName",acmodule,"oldModulename"

After converting this database to Access 2000 the following error occurs on the last line.

Run-Time Error '2501'
The CopyObject action was cancelled

If anyone can help I would be very grateful.

Thanks
Daniel
0
Comment
Question by:regodab
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 12

Expert Comment

by:Paurths
ID: 6450581
hi regodab,

have u tried using the Transferdatabase command?

DoCmd.TransferDatabase acImport, "Microsoft Access", FileName, acModule, "Nameoforiginalmodule", "Newnameofimportedmodule"

hope this helps,
Ricky
0
 

Author Comment

by:regodab
ID: 6450855
Ricky
I am trying to copy the object within the same database rather than copy it to or from the database I am running the code from. From what I have tried the suggestion above wont do this. any other suggestions?
Daniel
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6450929
ok, within the same database:

Private Sub cmdCopy_Click()
DoCmd.CopyObject , "NewNameOfModule", acModule, "CurrentNameOfModule"
End Sub
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:regodab
ID: 6450962
Paurths,
If you read the original question, this is what I am trying.

Ricky
I have tried your suggestion, copying a module from the database running the code to the remote database. I get the same error with TransferDatabase instead of CopyObject.

Daniel
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6451054
regodab,
i think there is a misunderstanding here. (from my part)
What is it exactly that u want to do?

1) do u want to copy a module from the currentdatabase, and paste it into another database?
2) do u want to copy a module from another database and paste it into the currentdatabase?
3) do u want to copy a module from the currentdatabase and paste it in the same currentdatabase?


the first example i showed u is to import a module from another database
the second example just copies a module from the currentdatabase and paste it back into the same currentdatabase under a different name.

btw, no need to use "dim app as access.application"
try it without that.
0
 

Author Comment

by:regodab
ID: 6451684
paurths,
I don't want to do any of the options you mentioned. I am trying to copy a module in another database and paste it into the same (other) database with a new name.
Daniel
0
 
LVL 12

Accepted Solution

by:
Paurths earned 800 total points
ID: 6451844
hi regodab,

i see now what u mean,
anyway, i tested this code:

Private Sub cmdCopy_Click()
Dim app As Access.Application
Dim FileName As String
Set app = New Access.Application
FileName = "c:\test\testdb2k.mdb"
app.OpenCurrentDatabase FileName
app.DoCmd.CopyObject , "NewModTest", acModule, "ModTest"

Set app = Nothing
End Sub


and it works fine,

so, did u already install both service releases for Office 2K ?
http://www.microsoft.com/office/previous/default.htm  <--> downloads

Ricky
0
 

Expert Comment

by:amp072397
ID: 6791582
regodab:

Please return to and resolve this open question.

thanks!
amp
community support moderator
0
 

Expert Comment

by:amp072397
ID: 6814888
regodab:

You've logged in, please return here!

amp
0
 
LVL 54

Expert Comment

by:nico5038
ID: 6988488
for regodab

It's time to clean up this TA, so I will leave a recommendation in Community Support that this question is:
 - Answered by: Paurths  
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7002793
Per recommendation, force-accepted by
Netminder
CS Moderator
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

972 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