ption Compare Database
Option Explicit
Private Sub cmdBrowse_Click()
On Error GoTo err_cmdBrowse
Dim sPicture As String
sPicture = GetOpenFile_CLT(CurrentProject.Path & "\Afbeeldingen", "Select the File")
If sPicture <> "" Then
Me![txtPicture] = sPicture
Me![txtPicture] = Mid(Me![txtPicture], InStrRev(Me![txtPicture], "\") + 1)
Me![txtPicture] = LCase(Me![txtPicture])
Me!Picture.Picture = Me!txtPicture
Me.txbFoutmelding = ""
End If
exit_cmdBrowse:
Exit Sub
err_cmdBrowse:
MsgBox Error$
Resume exit_cmdBrowse
End Sub
Private Sub cmdBrowse_GotFocus()
cmdBrowse.ForeColor = vbBlue
End Sub
Private Sub cmdBrowse_LostFocus()
cmdBrowse.ForeColor = vbBlack
End Sub
Private Sub Form_Current()
On Error GoTo err_Form_Current
If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = CurrentProject.Path & "\Afbeeldingen" & "\" & Me!txtPicture
Me.txbFoutmelding = ""
Else
Me!Picture.Picture = ""
End If
exit_Form_Current:
Exit Sub
err_Form_Current:
Select Case Err.Number
Case 2220 'De verwachte afbeeldingen is niet te vinden.
Me.txbFoutmelding = "Kan geen afbeelding vinden"
Case Else
MsgBox Err.Number
End Select
Resume exit_Form_Current
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
If IsNull(Me!txtPicture) Or Me!txtPicture = "" Then
' do nothing
Else
Me!Picture.Picture = CurrentProject.Path & "\Afbeeldingen" & "\" & Me!txtPicture
Me.txbFoutmelding = ""
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
End Sub
Private Sub Picture_Click()
Application.FollowHyperlink (CurrentProject.Path & "\Afbeeldingen" & "\" & Me!txtPicture)
End Sub
Private Sub txtPicture_GotFocus()
txtPicture.ForeColor = vbBlue
End Sub
Private Sub txtPicture_LostFocus()
txtPicture.ForeColor = vbBlack
End Sub