need help with label reports
hi:
i have a students db and im trying to make a report that shows student image with name in a label view
my images stored in a folder and i have a code to call them by a combobox
i can't index my images or use any method because i'm getting my students table from another department in excel file that im importing as a table (for now that what i have)
now i did the same thing with a label report i insert a (text label with a syntax builder"=Trim([lastname] & [firstname] & [city])") i get the names in a column like a wanted. now i have to add a image control and modified the code to load the image from the folder
my code for showing an image
	
	
	
		
 hi:
i have a students db and im trying to make a report that shows student image with name in a label view
my images stored in a folder and i have a code to call them by a combobox
i can't index my images or use any method because i'm getting my students table from another department in excel file that im importing as a table (for now that what i have)
now i did the same thing with a label report i insert a (text label with a syntax builder"=Trim([lastname] & [firstname] & [city])") i get the names in a column like a wanted. now i have to add a image control and modified the code to load the image from the folder
my code for showing an image
		Code:
	
	
	Private Sub combo95_Change()
On Error GoTo ErrorHandler
    
    Dim str
    Dim strLastName As String
    Dim strFirstName As String
    
    str = Split(Me![combo95])
    Me.RecordsetClone.FindFirst "[studentid]='" & str(0) & "'"
    Me.Bookmark = Me.RecordsetClone.Bookmark
    
    strLastName = Me![lastname]
    strFirstName = Me![firstname]
    
    ' init image
    StudentPicture.Visible = False
    On Error GoTo PictureHandler
        
    Dim a As New FileSystemObject
    Dim strStudentName As String
    Dim fl As File
    Dim IsFileExsist As Boolean
    Dim strPlace As String
    
    
    strStudentName = "\\TAHZUKAMAIN\StudentsManager\data\Pictures\" & strLastName & " " & strFirstName & ".gif"
       If (Not IsFileExsist) Then
    strStudentName = "\\TAHZUKAMAIN\StudentsManager\data\Pictures\" & strLastName & " " & strFirstName & ".jpg"
    IsFileExsist = a.FileExists(strStudentName)
End If
    'Set fl = a.GetFile(strStudentName)
    
    IsFileExsist = a.FileExists(strStudentName)
    If IsFileExsist Then
        StudentPicture.Picture = strStudentName
        StudentPicture.Visible = True
    Else
   
        strPlace = [city].OldValue
        strStudentName = "\\TAHZUKAMAIN\StudentsManager\data\Pictures\" & strLastName & " " & strFirstName & " " & strPlace & ".gif"
  
        IsFileExsist = a.FileExists(strStudentName)
        If (IsFileExsist) Then
            StudentPicture.Picture = strStudentName
            StudentPicture.Visible = True
        End If
    End If
    
    Exit Sub
PictureHandler:
    Exit Sub
ErrorHandler:
    MsgBox Err.Description & " " & Err.Number
    Resume Next
End Sub
	
			
				Last edited: