Solved

CopyObject Cancelled in Access 97 to 2000 conversion

Posted on 2001-09-03
11
255 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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 200 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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