Programmatically update MDE/ADE file

A

Atlas

I know about Tony Toews updater utility, but I would prefer to enable e menu
command in my project to perform the following:
- close current MDE/ADE project
- run the update
- reopen the previuosly closed project

That would be perfect.

I thougth I could do that programmaticaly closing current project, opening
another access unbound project whose goal is to copy the network version of
the updated project locally, close the "updater" and launch back the updated
project...

Is it possible to close current project and before stopping execution,
launch another Access project?
If so, any primer on using office vb to access filesystem (simply copy one
file!)


Bye
 
A

Albert D. Kallal

I done exactly as you want for years.

I simply shell out to another mdb file called upgrade. Right before I shell
out I write out a small txt file of the from, and to file.

You can check out the filecopy command in the help.

I also put in a about a 1 second delay in the upgrade program....as when
existing ms-access..there can be some delay..and if you don't wait a
bit..then the file can still be in use...
 
A

Atlas

Albert D. Kallal said:
I done exactly as you want for years.

I simply shell out to another mdb file called upgrade. Right before I shell
out I write out a small txt file of the from, and to file.

You can check out the filecopy command in the help.

Albert, how do you manage the "shell out"? (Any code sample appreciated)


Thanks
 
A

Albert D. Kallal

Function JumpToUpGrade() As Boolean

' jumps to a mde file called "upgrade"
' it exists in the same directly as the currently running program

Dim strShellProg As String
Dim strCurrentDir As String
Dim strDB As String
Const q As String = """"

Dim fhand As Integer
Dim strCopyFile As String
Dim strRidesini As String
strDB = CurrentDb.Name

strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)))

' path to msaccess is required here
strShellProg = q & SysCmd(acSysCmdAccessDir) & "msaccess.exe" & q & " "


strShellProg = strShellProg & q & strCurrentDir & "RidesUpGrade.mdb" & q
& _
" /user " & q & "Admin" & q & " /pwd " & q & "Admin" & q

strCopyFile = strBackEndPath & "rides.mde"

strRidesini = strCurrentDir & "Rides.ini"
' MsgBox (strRidesini)
On Error Resume Next
Kill strRidesini
On Error GoTo 0


fhand = FreeFile
Open strRidesini For Output As fhand
Print #fhand, strCopyFile
Close #fhand


'MsgBox (strShellProg)

If Shell(strShellProg, vbNormalFocus) > 0 Then
Application.Quit
Else
MsgBox "Un able to run Rides upgrade", vbCritical
Application.Quit
End If


End Function
 
A

Atlas

Thanks Albert, it works flawlessly. I Gave 5000 milliseconds on timer to
give enough time to close the updating project.
Perfect!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top