• multiple photos (A2k)

    Author
    Topic
    #449557

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1102514

      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?

      • #1102516

        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

    Viewing 0 reply threads
    Reply To: multiple photos (A2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: