Code from Report to Form

  • Thread starter Thread starter Telesphore
  • Start date Start date
T

Telesphore

I use the following code with success for reports [rptStudentsClassList] on
students with their picture:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
If IsNull(Me.txtImageName) Then
Me.ImageFrame.Picture = ""
Me.ImageFrame.Visible = False
Else
Me.ImageFrame.Picture = Me.txtImageName
Me.ImageFrame.Visible = True
End If
End Sub

I would like to use the same code to add the picture of each student on an
existing form [frmStudentInscription]

What should I do?

Many thanks
 
Use an Image control on your form, and put similar code in the form's
Current event.

Carl Rapson
 
Thank you,

It works with the following code:
Private Sub Form_Load()
On Error Resume Next
If IsNull(Me.txtImageName) Then
Me.ImageFrame.Picture = ""
Me.ImageFrame.Visible = False
Else
Me.ImageFrame.Picture = Me.txtImageName
Me.ImageFrame.Visible = True
End If
End Sub

It is supposed that a share folder has already the students pictures and
that the field txtImageName in the tblStudentsList has the record of the
NameOfStudentPicture.jpg

Carl Rapson said:
Use an Image control on your form, and put similar code in the form's
Current event.

Carl Rapson

Telesphore said:
I use the following code with success for reports [rptStudentsClassList]
on students with their picture:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
If IsNull(Me.txtImageName) Then
Me.ImageFrame.Picture = ""
Me.ImageFrame.Visible = False
Else
Me.ImageFrame.Picture = Me.txtImageName
Me.ImageFrame.Visible = True
End If
End Sub

I would like to use the same code to add the picture of each student on
an existing form [frmStudentInscription]

What should I do?

Many thanks
 
Back
Top