expert:need help with label repotrs (1 Viewer)

eshai

Registered User.
Local time
Today, 23:47
Joined
Jul 14, 2015
Messages
193
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

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:

Cronk

Registered User.
Local time
Tomorrow, 08:47
Joined
Jul 4, 2013
Messages
2,770
If your code works for displaying the particular image in your form, you would think that the same code in the detail section of your label report would do the same.
 

eshai

Registered User.
Local time
Today, 23:47
Joined
Jul 14, 2015
Messages
193
If your code works for displaying the particular image in your form, you would think that the same code in the detail section of your label report would do the same.

i need help to modify the code and yes i think it well work
the code work on a combo box i need it to work on a textbox
 

Cronk

Registered User.
Local time
Tomorrow, 08:47
Joined
Jul 4, 2013
Messages
2,770
If you want help modifying your code, can you provide what you have already. Better still, post a cut down version of your database.
 

Users who are viewing this thread

Top Bottom