473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Automate MDE creation?

365 100+
Hi

just wondered if there is code to create an mde, just for ease really (lazyiness)

Cheers
Aug 31 '09 #1
11 3152
missinglinq
3,532 Expert 2GB
My guess would be no! And if you could it would be a really bad idea! Too many things can go awry during the creation that require the attention/intervention of the developer.

Linq ;0)>
Aug 31 '09 #2
ADezii
8,834 Expert 8TB
@Dan2kx
Aside from changing the Source and Destinations, use the code exctly as posted:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCreateMDE_Click()
  2. On Error GoTo Err_cmdCreateMDE
  3. Dim AppAccess As Access.Application
  4. Set AppAccess = New Access.Application
  5. Dim strSourceDB As String
  6. Dim strDestinationMDE As String
  7.  
  8. '****************** Customize here ******************
  9. strSourceDB = "C:\CreateMDE\Test.mdb"              '*
  10. strDestinationMDE = "C:\CreateMDE\TestMDE.mde"     '*
  11. '****************************************************
  12.  
  13. 'Code should go here to see if strDestinationMDE already exists!
  14.  
  15. DoCmd.Hourglass True    'Critical!!!
  16.  
  17. AppAccess.SysCmd 603, strSourceDB, strDestinationMDE
  18.  
  19. DoCmd.Hourglass False
  20.  
  21. MsgBox strSourceDB & " has successfully been converted to " & _
  22.        strDestinationMDE, vbExclamation, "MDE Conversion"
  23.  
  24. Exit_cmdCreateMDE:
  25.   Exit Sub
  26.  
  27. Err_cmdCreateMDE:
  28.   DoCmd.Hourglass False
  29.   MsgBox Err.Description & vbCrLf & vbCrLf & _
  30.          strSourceDB & " has not been successfully converted to " & _
  31.          strDestinationMDE, vbCritical, "MDE Conversion Failure"
  32.     Resume Exit_cmdCreateMDE
  33. End Sub
Sep 1 '09 #3
Dan2kx
365 100+
Does that work with the active DB?
Sep 1 '09 #4
ADezii
8,834 Expert 8TB
@Dan2kx
To be honest with you, I didn't test the code with an Active Database. If you do, I strongly suggest using a Copy and testing with that.
Sep 1 '09 #5
ajalwaysus
266 Expert 100+
In my experience this does not work on the active DB, because creating an MDE requires the DB to compile first which cannot happen while you are running code in VBA. But I must ask, why would you want code to make an MDE in the active DB when you can simply run the Make MDE File... from the tools?

-AJ
Sep 1 '09 #6
ADezii
8,834 Expert 8TB
I modified the code block so that it should create a *.MDE File based on the Active/Current Database with the exact Base Name as the *.MDB and in the same Directory. Although the code indicates success, the actual *.MDE is never created. The reason for this is more than likely that indicated by ajalwaysus in Post #6. I too would like the know the reason why you would even attempt this.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCreateMDE_Click()
  2. On Error GoTo Err_cmdCreateMDE
  3. Dim AppAccess As Access.Application
  4. Set AppAccess = New Access.Application
  5. Dim strSourceDB As String
  6. Dim strDestinationMDE As String
  7.  
  8. '*************************** Customize here ***************************
  9. strSourceDB = CurrentProject.Path & "\" & CurrentProject.Name
  10. strDestinationMDE = Left$(strSourceDB, Len(strSourceDB) - 4) & ".mde"
  11. '**********************************************************************
  12.  
  13. 'Code should go here to see if strDestinationMDE already exists!
  14.  
  15. DoCmd.Hourglass True    'Critical!!!
  16.  
  17. AppAccess.SysCmd 603, strSourceDB, strDestinationMDE
  18.  
  19. DoCmd.Hourglass False
  20.  
  21. MsgBox strSourceDB & " has successfully been converted to " & _
  22.        strDestinationMDE, vbExclamation, "MDE Conversion"
  23.  
  24. Exit_cmdCreateMDE:
  25.   Exit Sub
  26.  
  27. Err_cmdCreateMDE:
  28.   DoCmd.Hourglass False
  29.   MsgBox Err.Description & vbCrLf & vbCrLf & _
  30.          strSourceDB & " has not been successfully converted to " & _
  31.          strDestinationMDE, vbCritical, "MDE Conversion Failure"
  32.     Resume Exit_cmdCreateMDE
  33. End Sub
Sep 1 '09 #7
missinglinq
3,532 Expert 2GB
That would require two or three mouse clicks, and as he said, he's lazy!

Linq ;0)>
Sep 1 '09 #8
Dan2kx
365 100+
@missinglinq
Yep just wondered if it was theoretically possible, i am a little lazy as mensioned; i have a version number hardcoded into VB (and therefore the MDE) and a version number stored in a linked table so that old versions "know" that they are old and then download the most current version from a server location, in my update code i was considering using the MDE automation... upon your advice i think i should reconsider yes?

Thanks anyways,

Dan
Sep 1 '09 #9
ajalwaysus
266 Expert 100+
I have developed a version controlled databases, like it sounds like you are. When dealing with revision control, you usually need a singular hub (Switchboard) to handle all the version control, so that if what you need is out of date the Switchboard would then get you the most up to date.

Since I have a lot of experience with this, I could provided you with some best practices. But so i don't do the work for you, you can bounce some ideas off me if you wish.

-AJ
Sep 1 '09 #10
Dan2kx
365 100+
I think i have the version control pretty sussed, i only ever have "the newest" release which over writes the previous MDE, so if the active version is out of date (upon DB open) it creates a CMD file, closes, runs the CMD file to pull the new version and wallah!

Pretty simple but it works well, put some of my collegues to shame (who have no version control, or simply a message to alert you to seek the new version)

i can post the code if you are curious?

Thanks again

Dan
Sep 1 '09 #11
ajalwaysus
266 Expert 100+
I'm good, thanks. But this is a different way than I do it, sounds interesting. Have Fun!

-AJ
Sep 1 '09 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jon Gross | last post by:
We have a project that will require the almost realtime (every 5 minutes) creation of user accounts and a FTP site for each of them. I would like to write a VB.Net application to do this. This...
4
by: Chris via AccessMonster.com | last post by:
I have the challenge of needing to automate table creation. It doesn't end there the tables have to be created from one table that looks something like this... Email ...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
2
by: Jeremy | last post by:
Is anyone aware of any features in .NET or 3rd party tools that would enable the automated creation/modification of graphics (e.g., buttons with text in them). I frequently need to modify only the...
3
by: Nick Dreyer | last post by:
I was quite surprised to notice that Sub New() gets called twice, once at declaration time and once at creation time. I can't figure out why it would be called at declaration if there is no class...
15
by: Karl | last post by:
Hi all, I regularly use FTP to place Self Extracting Zip files on the web for remote users to update their datafiles. Works very nicely. I have automated the creation of the initial zip file (...
0
by: amg | last post by:
I'm looking for a way to automate the creation of an ODBC System DSN for an Oracle driver (Oracle client 10g). Any help (scripts, pointers, sample code) will be greatly appreciated. Thanks,
11
by: gert365 | last post by:
I'm working on a scirpt to be used on a windows machine and I need to automate a user's input on the command prompt. For example I'm using os.system('mycommand') to excute the commands I want. ...
9
by: Ots | last post by:
I'm using SQL 2000, which is integrated with a VB.NET 2003 app. I have an Audit trigger that logs changes to tables. I want to apply this trigger to many different tables. It's the same trigger,...
2
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
Is it possible to automate a COM object ebmeded in an excel document run the process and return the results in a C# .NET application? Or better yet extract the com object some how and just run it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.