Solved

CopyObject Cancelled in Access 97 to 2000 conversion

Posted on 2001-09-03
11
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

739 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