paindivine
Registered User.
- Local time
- Yesterday, 21:09
- Joined
- Dec 13, 2006
- Messages
- 23
I'm trying to incorportate Bob Larsons autoupdating utility... It works in that it checks the version, and if its wrong it creates the batch file... but then Access gets a message that says "importing: blah\blah\blah\NoPhoto.jpg" and access freezes. It doesn't delete the old file or copy the new file.
The address it lists as importing is a hyperlink that I have stored on each record (A picture of the contact the record is about)
The address it lists as importing is a hyperlink that I have stored on each record (A picture of the contact the record is about)
Code:
Private Sub Form_Current()
Me![im_Photo].Picture = Me![Photo]
End Sub
Private Sub Form_Load()
Dim strFEMaster As String
Dim strFE As String
Dim strMasterLocation As String
Dim strFilePath As String
' looks up the version of the front-end as listed in the backend
strFEMaster = DLookup("fe_version_number", "tbl-version_fe_master")
' looks up the version of the front-end on the front-end
strFE = DLookup("fe_version_number", "tbl-fe_version")
' looks up the location of the front-end master file
strMasterLocation = DLookup("s_masterlocation", "tbl-version_master_location")
' checks for the existence of an updating batch file and deletes it if it exists
strFilePath = CurrentProject.Path & "\UpdateDbFE.cmd"
If Dir(strFilePath) <> "" Then
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile (strFilePath)
Set fs = Nothing
End If
' if the current database opened is the master then it bypasses the check.
If CurrentProject.Path = strMasterLocation Then
Exit Sub
Else
' if the version numbers do not match and it is not the master that is opened,
' the database will do the update process
If strFE <> strFEMaster Then
MsgBox "Your program is not the latest version." & vbCrLf & _
"The front-end needs to be updated. The program will " & vbCrLf & _
"now close and then should reopen automatically.", vbCritical, "VERSION NEEDS UPDATING"
' sets the global variable for the path/name of the current database
g_strFilePath = CurrentProject.Path & "\" & CurrentProject.Name
' sets the global variable for the path/name of the database to copy
g_strCopyLocation = strMasterLocation
' calls the UpdateFrontEnd module
UpdateFrontEnd
End If
End If
End Sub
Private Sub New_Record_Click()
On Error GoTo Err_New_Record_Click
DoCmd.GoToRecord , , acNewRec
Exit_New_Record_Click:
Exit Sub
Err_New_Record_Click:
MsgBox Err.Description
Resume Exit_New_Record_Click
End Sub
Private Sub Combo53_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[UserID] = '" & Me![Combo53] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Save_Click()
On Error GoTo Err_Save_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Save_Click:
Exit Sub
Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub
Private Sub OpenCalls_Click()
On Error GoTo Err_OpenCalls_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Calls Past 7 days"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenCalls_Click:
Exit Sub
Err_OpenCalls_Click:
MsgBox Err.Description
Resume Exit_OpenCalls_Click
End Sub
Private Sub Past7days_Click()
On Error GoTo Err_Past7days_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Calls Past 7 days"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Past7days_Click:
Exit Sub
Err_Past7days_Click:
MsgBox Err.Description
Resume Exit_Past7days_Click
End Sub
Private Sub Refresh_Click()
On Error GoTo Err_Refresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Refresh_Click:
Exit Sub
Err_Refresh_Click:
MsgBox Err.Description
Resume Exit_Refresh_Click
End Sub