Solved

CopyObject Cancelled in Access 97 to 2000 conversion

Posted on 2001-09-03
11
251 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

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…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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 Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

708 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

13 Experts available now in Live!

Get 1:1 Help Now