Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2002
    Location
    Patagonia Region Chile
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    multiple photos (A2k)

    Hello.

    Hope all are well.

    I have odbc linked tables that prevent me from normalizing into master detail. Master=model_number. And Detail=multiple photos.

    I need to create a report.
    For each Detail Record (model number) I need to show a main photo and 3 details photos.
    The name and path to the photos is contained in the model number table which has fields.
    Model_num
    image_main
    image_detail_1
    image_detail_2
    image_detail_3

    If a particular model number does not have all 3 details or has none, I am trying to make the control become invisible. I am using this code... but it is stalling and giving errors that it can not open the image file. In the case that it can not open the image file, the code should jump down to the where the on_error_goto tells it, but it does not. It returns an error.

    The idea of this code is similar in logic to nested if then logic. It uses nested on_error_goto.. to cycle through each image control on the report.. If it gets an error it makes in invisible and moves on.

    Any thought would be much appreciated. The code follows.


    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Me.imgVisual.Visible = True
    Me.imgVisual1.Visible = True
    Me.imgVisual2.Visible = True
    Me.imgVisual3.Visible = True

    On errror GoTo Err_DisplayImage
    Me.imgVisual.Picture = Me.ImgTextPath

    On Error GoTo Err_DisplayImage1
    Me.imgVisual1.Picture = Me.ImgTextPath1
    On Error GoTo Err_DisplayImage2
    Me.imgVisual2.Picture = Me.ImgTextPath2
    On Error GoTo Err_DisplayImage3
    Me.imgVisual3.Picture = Me.ImgTextPath3

    Err_DisplayImage:
    Me.imgVisual.Visible = False
    On Error GoTo Err_DisplayImage1
    Me.imgVisual1.Picture = Me.ImgTextPath1
    On Error GoTo Err_DisplayImage2
    Me.imgVisual2.Picture = Me.ImgTextPath2
    On Error GoTo Err_DisplayImage3
    Me.imgVisual3.Picture = Me.ImgTextPath3

    Err_DisplayImage1:
    Me.imgVisual1.Visible = False
    On Error GoTo Err_DisplayImage2
    Me.imgVisual2.Picture = Me.ImgTextPath2
    On Error GoTo Err_DisplayImage3
    Me.imgVisual3.Picture = Me.ImgTextPath3

    Err_DisplayImage2:
    Me.imgVisual2.Visible = False
    On Error GoTo Err_DisplayImage3
    Me.imgVisual3.Picture = Me.ImgTextPath3

    Err_DisplayImage3:
    Me.imgVisual3.Visible = False

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: multiple photos (A2k)

    You should insert a line

    Exit Sub

    above each of the Err_... labels.

    You could check whether the path field is not null before trying to set the Picture property.

    Your first On Error statement has errror (too many r's).

    Does the code in the attached text file work better?
    Attached Files Attached Files

  3. #3
    Star Lounger
    Join Date
    May 2002
    Location
    Patagonia Region Chile
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: multiple photos (A2k)

    You are so very GOOD my friend.

    On first test, your code worked perfectly on my test data. Will play more tomorrow on various situations.

    Thank you Hans. I truly appreciate it.

    Regards.

    Jason

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •