PC Review


Reply
Thread Tools Rate Thread

Copy module to another db causes error

 
 
=?Utf-8?B?TW9ydGljaWEgQWRkYW1z?=
Guest
Posts: n/a
 
      27th Feb 2005
Could someone assist in finding a different way to ship a Module over from
one Access'97 database to another with the same module name? The second
DoCmd.CopyObject causes an error. lt doesn't matter whether the second parm
is used for [newname], or not (lt could read , , acTable, "Dates" as well.).

Using the TransferDatabase Method yields a nice 32318....

DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "EZAActuals",
acTable, "EZA_Actuals_MSD"
DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "CalcEZADates",
acModule, "CalcEZADates"
DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "EZADates",
acTable, "EZADates"

TIA

P.S. l have figured out there is a large glitch in the acModule module -vb.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?JzY5IENhbWFybw==?=
Guest
Posts: n/a
 
      27th Feb 2005
Hi.

You don't mention the error message, but I can guess. And Microsoft Access
crashed immediately following the message, didn't it? It's due to an
"unhandled error exception" when copying a module object from one Access 97
database to another. Use the "DoCmd.CopyObject" method for copying tables,
queries, forms, reports, and macros to another database, but use the
"DoCmd.TransferDatabase" method for copying modules. Use the following code
to copy your tables and module:

DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "EZAActuals",
acTable, "EZA_Actuals_MSD"
DoCmd.TransferDatabase acExport, "Microsoft Access",
"\\ServerName\DirName\RealData.MDB", acModule, "CalcEZADates", "CalcEZADates"
DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", , acTable,
"EZADates"

A few warnings are in order:

1.) If a module exists in the destination database that has the same name
as your source module, the destination database module will be overwritten
with the module in your source database, and you won't get the warning
message asking you if this is acceptable as you would with the
"DoCmd.CopyObject" method.

2.) When copying multiple database object types from one Access 97 database
to another, don't use the "DoCmd.TransferDatabase" method for any of the
database object types other than the module. You can get the "Object invalid
or no longer set" error if attempting to export multiple object types in
sequence with the "DoCmd.TransferDatabase" method. There's no such problem
with the "DoCmd.CopyObject" method.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question, please sign in to Microsoft's
Online Community and mark these posts, so that all may benefit by filtering
on "Answered questions" and quickly finding the right answers to similar
questions.


"Morticia Addams" wrote:

> Could someone assist in finding a different way to ship a Module over from
> one Access'97 database to another with the same module name? The second
> DoCmd.CopyObject causes an error. lt doesn't matter whether the second parm
> is used for [newname], or not (lt could read , , acTable, "Dates" as well.).
>
> Using the TransferDatabase Method yields a nice 32318....
>
> DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "EZAActuals",
> acTable, "EZA_Actuals_MSD"
> DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "CalcEZADates",
> acModule, "CalcEZADates"
> DoCmd.CopyObject "\\ServerName\DirName\RealData.MDB", "EZADates",
> acTable, "EZADates"
>
> TIA
>
> P.S. l have figured out there is a large glitch in the acModule module -vb.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error in Hidden Module: Module 1 Alberto Ast Microsoft Excel Programming 1 26th Jan 2010 08:35 AM
Compile Error in Hidden Module: Module 1 Mim Microsoft Excel Programming 2 23rd Jan 2010 12:22 AM
How to Copy a VB Module Ken Hudson Microsoft Excel Programming 7 21st Dec 2009 06:59 PM
Can't "Call" Error Handler in Standard Module from Form Module =?Utf-8?B?Sm9obiBE?= Microsoft Access VBA Modules 8 21st Apr 2007 07:24 PM
Problem calling Error Handler in Standard Module from Form Module =?Utf-8?B?Sm9obiBE?= Microsoft Access Form Coding 2 19th Apr 2007 02:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:27 AM.