Code from Report to Form

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
 
C

Carl Rapson

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

Carl Rapson
 
T

Telesphore

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top