Solved

Closed prematurely - Still need help with Autoexec

Posted on 2006-06-19
12
326 Views
Last Modified: 2006-11-18
Cross REf: http://www.experts-exchange.com/Databases/MS_Access/Q_21891519.html


My orignial code has me processing the 2nd mdb and then closing it and then zip the update mdb and then 3rd mdb is opened by user for them to save to their pc.

Should I do a filecopy of the original mdb, reopen the copy - rename the autoexec in that copy and then zip it? and How do I deactivate the autoexec in the newly copied mdb - since it will be in the copied version also.

What do you think.

Karen
0
Comment
Question by:Karen Schaefer
  • 5
  • 5
12 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 16937687
Why dont u make a copy of the 2nd mdb

then run that which processes it
then delete the object in that db?

so u always leave your master 2nd mdb, just make a copy and send that?

0
 

Author Comment

by:Karen Schaefer
ID: 16937705
How do I stop the autoexec in the copied version of the mdb - so that I can rename the macro?

Karen
0
 

Author Comment

by:Karen Schaefer
ID: 16937711
Can I send  the code from my 1st mdb to rename a macro in another mdb?

K
0
 

Author Comment

by:Karen Schaefer
ID: 16937746
This what I have come up with so far:

   ShellEx "\\Wabelhdk0215892\Intranet Information Server\CorePlan\Manual PLANIT Forecast For Scrubbing.mdb" ', , , , ,
    FileCopy "\\Wabelhdk0215892\Intranet Information Server\CorePlan\Manual PLANIT Forecast For Scrubbing.mdb", "\\Wabelhdk0215892\Intranet Information Server\CorePlan\TempCopy\Manual PLANIT Forecast For Scrubbing.mdb"
     ShellEx "\\Wabelhdk0215892\Intranet Information Server\CorePlan\TempCopy\Manual PLANIT Forecast For Scrubbing.mdb" ', , , , ,
 
 but the autoexec still exist in the tempcopy of the mdb.  need to deactivate or delete the autoexec from here?

K
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16937897
This bit of code deletes a object on another DB


    Dim acc As Object
    Dim strFullFilePath As String
   
    Set acc = CreateObject("Access.Application")
   
    acc.OpenCurrentDatabase "C:\EE\mydb3.mdb"
    acc.DoCmd.DeleteObject acMacro, "AutoExec"

    Set acc = Nothing


So u make a copy of your 2nd mdb, then run the autoexec
you then want to delete that autoexec right?
try the above code

I guess if you want to rename it, u could try this

    acc.DoCmd.Rename "NewMacroName", acMacro, "OldMacroName"

0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Karen Schaefer
ID: 16937933
is it possible to use a IF statement or Select Case to validate which currentdatabase is open and if not equeal to the original mdb filepath then delete or rename the macro - instead of having to copies of the same mdb.

if so what is the best approach to handle this.

K
0
 

Author Comment

by:Karen Schaefer
ID: 16937973
How do I return the current value (ie. filepath) of active mdb?

K
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16937974
Not sure what you mean

I thought u have your masters

then make copy of your masters and just delete the object in there
this way you shouldn't need to worry about anything else do you? sorry for sounding confused

Karen, Ive got to go now, hopefully Ive given you something to help you along the way, looks like u still need some help.
If no one else has answered, I will help you tomorrow (if Im still sober! - Im going to the pub to watch England play Sweden)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16937979
currentpath is

CurrentProject.Path

to get full path of current db

CurrentProject.Path & "\" & CurrentProject.name
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 16941014
Can I suggest u place your paths in variables - here it is, hopefully you understand the logic, just add in the missing bits
What Im saying is you create your Masters. These do not have any processing done on them
What u do is make a copy then run processing on these copies and delete/rename macros. Safe thing is the master is left alone.



dim sOriginal as String
dim sCopy as String


sOriginal = "\\Wabelhdk0215892\Intranet Information Server\CorePlan\Manual PLANIT Forecast For Scrubbing.mdb"
sCopy = "\\Wabelhdk0215892\Intranet Information Server\CorePlan\TempCopy\Manual PLANIT Forecast For Scrubbing.mdb"


'Lets take original and make a copy
FileCopy sOriginal, sCopy

'Now run the macro
ShellEx sCopy ', , , , ,

'Now delete the AutoExec Macro in the copy

    Dim acc As Object
    Dim strFullFilePath As String
   
    Set acc = CreateObject("Access.Application")
   
    acc.OpenCurrentDatabase sCopy
    acc.DoCmd.DeleteObject acMacro, "AutoExec"
'or
    acc.DoCmd.Rename "OldAutoExec", acMacro, "AutoExec"

    Set acc = Nothing






But if u want the Master to have the processing done on it
then you have to

1. Run processing on Master
2. Make copy of Master to temp
3. Delete/Rename Macro in Temp
4. Do what you want with Temp


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

705 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

16 Experts available now in Live!

Get 1:1 Help Now