Solved

CopyObject Cancelled in Access 97 to 2000 conversion

Posted on 2001-09-03
11
252 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
 

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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now