Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2007, 05:58 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Make Destination mdb file Executable

Hi All
I hope every one have nice day like me .....:)

'Task to Acheive
'Make Destination mdb file Executable

FileCopy Me.txtFileName, DirectoryFileName
'where txtFileName = Name of Source file
'DirectoryFilename = Destination File Name



'Trying to change directory with no reason assuming it will
'change working folder

ChDir txtDirectoryPath

' Make it executable but not working
DoCmd.RunCommand acCmdMakeMDEFile

Any miricale programmer

Regards

Ayaz

 
Old April 24th, 2007, 06:59 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

A replicated database can't be saved as an .mde file; however, once a database is saved as an .mde file, it can be replicated.

Type "MDE Property" in the Access VBA help cbo for more details.

IOW, you can't create an mde with a file copy method.

HTH

mmcdonal
 
Old April 24th, 2007, 07:11 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Hi mmcdonal

Thanks for your review

FileCopy is copying mdb file to different location and then i was trying to make mde from that mde file which stores on different location by using Docmd.RunCommand acCMmdMakeMDEFile

regards
Ayaz

 
Old April 24th, 2007, 07:38 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Mistype

I was trying to make mde from that mdb file which stores on different location by using Docmd.RunCommand acCMmdMakeMDEFile


 
Old April 24th, 2007, 07:51 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Hi

I've found this article on http://support.microsoft.com/kb/q202039/
I tried this but its opening dialog box asking to save mde and then keep asking to SaveAs

Microsoft explain it very simple but implementation is just like microsoft itself :)

Function GenerateMDEFile(MyPath As String)

   Dim NAcc As Access.Application

   Set NAcc = CreateObject("Access.Application")

   'The following lines simulate accepting the default
   'name, clicking Make MDE, and clicking Save
   SendKeys MyPath & "{Enter}{Enter}"
   SendKeys "{Enter}"

   NAcc.DoCmd.RunCommand acCmdMakeMDEFile

   Set NAcc = Nothing

End Function

Any idea, suggestion, advice

regards

Ayaz

 
Old April 24th, 2007, 07:58 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You always have to use the Save As when doing an MDE since you can't save over the mdb. In other words, the file is an mdb, to SAVE AS an mde, you have to use that dialog box. Add commas after this line and see if there are clauses that allow you to prevent the save as prompt:

NAcc.DoCmd.RunCommand acCmdMakeMDEFile, , , ,

Did that help?

mmcdonal
 
Old April 24th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

NAcc.DoCmd.RunCommand acCmdMakeMDEFile, , , ,
 when press commma keys its shows RunCommand(Command As AcCommand)

But cant work invalid syntax error

Ayaz

 
Old April 24th, 2007, 08:36 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Function GenerateMDEFile(MyPath As String)

    On Error Resume Next

    Dim NAcc As Access.Application
    Dim MDEName As String

    Set NAcc = New Access.Application

    'here switch the mdb extension with .mde
    'test if it has already been created

    MDEName = Left$(MyPath, Len(MyPath) - 4) & ".mde"

    If Not FileMDEExists(MDEName) Then
        SendKeys MyPath & "{Enter}{Enter}"
        SendKeys "{Enter}"
        NAcc.DoCmd.RunCommand acCmdMakeMDEFile
    Else
        MsgBox "this mde file already exists, specify a different name."
        Exit Function
    End If

    Set NAcc = Nothing


End Function

Public Function FileMDEExists(ByVal FileSpec As String) As Boolean
On Error Resume Next
FileMDEExists = (GetAttr(FileSpec) And vbDirectory) = vbNormal
End Function

<b>Still trying to open box and trying to save as mde but not cearting mde</b>

 
Old April 25th, 2007, 04:54 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Any Idea Please its still not working





Similar Threads
Thread Thread Starter Forum Replies Last Post
SSIS - Flat file to OLEDB Destination carumuga SQL Server DTS 0 September 1st, 2008 10:13 AM
Running executable file Promod333 Visual Basic 2005 Basics 1 September 7th, 2007 10:15 AM
How to make a java project executable. sharadagarwal BOOK: Beginning Java 2 2 June 27th, 2004 01:21 PM
php executable file hosefo81 PHP How-To 4 March 23rd, 2004 10:07 PM
dll.files in a executable file KennethMungwira VB.NET 1 December 12th, 2003 05:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.