Option Compare Database
Option Explicit
Dim filename As String, Pathname As String, db As Database
Private Sub Form_Current()
Dim Securitycolor As String
Set db = CurrentDb
On Error GoTo PhotoNone 'If no photo exists this will handle that
filename = db.name
Pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
'-------------------------------------------------------------------------------------------
'I have a frame around the image holder that indicates clearance levels by
color
'-------------------------------------------------------------------------------------------
Securitycolor = SecurityLevel.Value
Select Case Securitycolor
Case "Green"
Me.Frame69.BackColor = 32768
Me.Approved.BackColor = 32768
Case "Yellow"
Me.Frame69.BackColor = 65535
Me.Approved.BackColor = 65535
Case "Red"
Me.Frame69.BackColor = 255
Me.Approved.BackColor = 255
Case "Orange"
Me.Frame69.BackColor = 33023
Me.Approved.BackColor = 33023
Case "Black"
Me.Frame69.BackColor = 0
Me.Approved.BackColor = 0
End Select
'---------------------------------------------
'This line inserts the photo in the form
'---------------------------------------------
Me.imgPHOTO.Picture = Pathname & Me.ID & ".jpg"
Exit Sub
PhotoNone:
'------------------------------------------------------
'If no photo exists a graphic is displayed instead
'-------------------------------------------------------
Me.imgPHOTO.Picture = Pathname & "NoPix.JPG"
End Sub
Hope this helps.
StuD.