Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Plusieurs images dans un état

1 réponse
Avatar
Nathalie
Bonjour le forum,

Dans un rapport, je dois faire apparaitre des images.
le rapport représente une suite de fiches descriptives.
J'ai entre 1 et 4 photos par fiche.
J'ai une banque d'images . La table me donnant les noms d'image et du style:

ItemID Photo1 Photo2 Photo3 Photo4
Item1 IMG_001 IMG_234
Item2 IMG-045
Item3 IMG-002 IMG_457 IMG_005 IMG_987
etc

Dans le rapport il y a 4 contrôles "image" pour les photos..

Le pb que je rencontre:

Par exemple sur la fiche de l'item 2 j'aurai la photo"IMG045" et la photo
IMG_234..

Voici le code que j'utilise:

Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)

Me!Photo1.Picture = "C:\Rep" & Me![Photo1Nom] & ".JPG"

If IsNull(Me!Photo2Nom) Then
Me.Photo2.Picture = ""
Exit Sub
End If
Me!Photo2.Picture = "C:\Rep" & Me![Photo2Nom] & ".JPG"

If IsNull(Me!Photo3Nom) Then
Me.Photo3.Picture = ""
Exit Sub
End If

Me!Photo3.Picture = "\C:\Rep" & Me![Photo3Nom] & ".JPG"

If IsNull(Me!Photo4nom) Then
Me.Photo4.Picture = ""
Exit Sub
End If
Me!Photo4.Picture = "C:\Rep" & Me![Photo4nom] & ".JPG"

End Sub

Si quelqu'un a une idée.. cela m'aiderait beaucoup car je suis dans le
"rush"!!! et que je n'y comprends plus rien!!!

MErci

1 réponse

Avatar
Raymond [mvp]
Bonsoir.

essaie plutôt ceci:
Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)
If Nz(Me![Photo1Nom], "") = "" Then
Me!photo1.Picture = ""
Me!photo1.Visible = False
Else
Me!photo1.Picture = "C:Rep" & Me![Photo1Nom] & ".JPG"
Me!photo1.Visible = True
End If

If Nz(Me![Photo2Nom], "") = "" Then
Me!photo2.Picture = ""
Me!photo2.Visible = False
Else
Me!photo2.Picture = "C:Rep" & Me![Photo2Nom] & ".JPG"
Me!photo2.Visible = True
End If

'et ainsi de suite

End Sub


--
@+
Raymond Access MVP
http://OfficeSystem.Access.free.fr/
http://OfficeSystem.Access.free.fr/runtime/
http://users.skynet.be/mpfa/ pour débuter sur le forum


"Nathalie" a écrit dans le message de
news:
Bonjour le forum,

Dans un rapport, je dois faire apparaitre des images.
le rapport représente une suite de fiches descriptives.
J'ai entre 1 et 4 photos par fiche.
J'ai une banque d'images . La table me donnant les noms d'image et du
style:

ItemID Photo1 Photo2 Photo3 Photo4
Item1 IMG_001 IMG_234
Item2 IMG-045
Item3 IMG-002 IMG_457 IMG_005 IMG_987
etc

Dans le rapport il y a 4 contrôles "image" pour les photos..

Le pb que je rencontre:

Par exemple sur la fiche de l'item 2 j'aurai la photo"IMG045" et la photo
IMG_234..

Voici le code que j'utilise:

Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)

Me!Photo1.Picture = "C:Rep" & Me![Photo1Nom] & ".JPG"

If IsNull(Me!Photo2Nom) Then
Me.Photo2.Picture = ""
Exit Sub
End If
Me!Photo2.Picture = "C:Rep" & Me![Photo2Nom] & ".JPG"

If IsNull(Me!Photo3Nom) Then
Me.Photo3.Picture = ""
Exit Sub
End If

Me!Photo3.Picture = "C:Rep" & Me![Photo3Nom] & ".JPG"

If IsNull(Me!Photo4nom) Then
Me.Photo4.Picture = ""
Exit Sub
End If
Me!Photo4.Picture = "C:Rep" & Me![Photo4nom] & ".JPG"

End Sub

Si quelqu'un a une idée.. cela m'aiderait beaucoup car je suis dans le
"rush"!!! et que je n'y comprends plus rien!!!

MErci