Solved

Closed prematurely - Still need help with Autoexec

Posted on 2006-06-19
12
328 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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
 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 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