Problem for creating a sub form

  • Thread starter Thread starter André
  • Start date Start date
A

André

Hello,

I create one relational database for a catalog with pictures. For one
product you can have more than 1 picture. For these sample, I have 2
tables :
One for the product and one for the detail.

Now, for the pictures, I save the name of the file (picture) in the
child table

Example

record (master) Product record (child) Detail

1 A 1 picture 1
2 picture 2
3 picture 3

When i create the form and sub-form to encode the data, i have i big
problem (child side). When i select a record, (the record 2 for
example), all records (1,2 and 3) for this item have the same picture
(here picture 2). If i select the record 3, all items will have the
picture 3

My question is : How i can show the picture 1 for record 1, picture 2
for record 2, and so on ....

For info : on sub form, on_current event, i put the following code :

If Me.photo_nom <> "" Then
' in case of the field is not empty, show the picture

Me.photo1.Picture = dir_photo & Me.photo_nom & ext
Else
' in case of empty field, show a default picture

Me.photo1.Picture = dir_defaut & "Bluefly_mycatalog.gif"
End If

Thank you for advance for your support

Andre
 
Display the paths of the pictures in a subform which contains the table from
the many side of the relationship. Use an image control on the main form.
Then in the On Current event of the subform, write a bit of code like
(aircode):

Sub Form_Current()
Me.Parent.NameOfImageCtrl.Picture = Me.txtPath
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Hello,

First, thank you for your reaction.

If i understood, I'm mendatory to put the picture on the MAIN form !

Now, if, for one product, i have 4 pictures, How i can show the 4
pictures ?

Andre
 
Back
Top