Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

Copy module to another db causes error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Morticia Addams - 27 Feb 2005 07:43 GMT
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.
'69 Camaro - 27 Feb 2005 08:31 GMT
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.

> 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
[quoted text clipped - 13 lines]
>
> P.S.  l have figured out there is a large glitch in the acModule module -vb.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.