floydpepper
Technical User
Ladies and Gents!
Please help. I have a form (Form Main)whose source is a table (Tbl Main). The data base is being established to track personnel info (including .jpg pictures) for HR. I have used the following code (from forums on this site) in the On Current property for the form:
Private Sub Form_Current()
On Error GoTo err_Form_Current
If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = GetPathPart & Me!txtPicture
Else
Me!Picture.Picture = ""
End If
exit_Form_Current:
Exit Sub
err_Form_Current:
MsgBox Err.Description
Resume exit_Form_Current
End Sub
and this code in the On Open event:
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 = GetPathPart & Me!txtPicture
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open
End Sub
with this Function included:
Private Function GetPathPart() As String
' Comments : Returns the path part of a string
' Parameters: strPath - string to parse
' Returns : path part
'
Dim db As DAO.Database
Dim strPath As String
Dim intCounter As Integer
Set db = CurrentDb
strPath = db.Name
db.Close
Set db = Nothing
For intCounter = Len(strPath) To 1 Step -1
If Mid$(strPath, intCounter, 1) = "\" Then
Exit For
End If
Next intCounter
GetPathPart = Left$(strPath, intCounter)
End Function
The form works great. The only difficulty I am having is that the pictures have to be placed on my desktop for the form to function. Is there a way I can designate a specific folder/path for the link so that the users can keep their desk tops clean?
Thank you in advance. The members of this community have been a great help in my slow yet steady development.
FloydP
Please help. I have a form (Form Main)whose source is a table (Tbl Main). The data base is being established to track personnel info (including .jpg pictures) for HR. I have used the following code (from forums on this site) in the On Current property for the form:
Private Sub Form_Current()
On Error GoTo err_Form_Current
If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = GetPathPart & Me!txtPicture
Else
Me!Picture.Picture = ""
End If
exit_Form_Current:
Exit Sub
err_Form_Current:
MsgBox Err.Description
Resume exit_Form_Current
End Sub
and this code in the On Open event:
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 = GetPathPart & Me!txtPicture
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open
End Sub
with this Function included:
Private Function GetPathPart() As String
' Comments : Returns the path part of a string
' Parameters: strPath - string to parse
' Returns : path part
'
Dim db As DAO.Database
Dim strPath As String
Dim intCounter As Integer
Set db = CurrentDb
strPath = db.Name
db.Close
Set db = Nothing
For intCounter = Len(strPath) To 1 Step -1
If Mid$(strPath, intCounter, 1) = "\" Then
Exit For
End If
Next intCounter
GetPathPart = Left$(strPath, intCounter)
End Function
The form works great. The only difficulty I am having is that the pictures have to be placed on my desktop for the form to function. Is there a way I can designate a specific folder/path for the link so that the users can keep their desk tops clean?
Thank you in advance. The members of this community have been a great help in my slow yet steady development.
FloydP