Copy module to another db causes error

G

Guest

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.
 
G

Guest

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
 
Top