Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Closed prematurely - Still need help with Autoexec

Posted on 2006-06-19
12
Medium Priority
?
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

730 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