Minggu, 10 Januari 2016

Re: [MS_AccessPros] Error on report opening while no picture

 

John,


This is OK and no error coming, the only thing remained is that msgbox displays twice. I tried to put Cancel = -1 but even then msgbox displays twice.

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If IsNull(Me![ImagePath]) Then
        MsgBox "Bar code/picture not found for this Sale Invoice." _
        , vbInformation, "PCTL Management - Information"
        Me.ImageFrame.Visible = False
Cancel = -1  <======
    Else
        Me.ImageFrame.Visible = True
        Me![ImageFrame].Picture = Me![ImagePath]
    End If
End Sub

Regards,
Khalid


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Khalid-

The problem is you're canceling the event, so that causes none of the controls to display.  Try this:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If IsNull(Me![ImagePath]) Then
        MsgBox "Bar code/picture not found for this Sale Invoice." _
        , vbInformation, "PCTL Management - Information"
        Me.ImageFrame.Visible = False
    Else
        Me.ImageFrame.Visible = True
        Me![ImageFrame].Picture = Me![ImagePath]
    End If
End Sub

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On Jan 10, 2016, at 9:03 AM, Khalid Tanweer khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,
I am back again with my Report "Sale Invoice Selective Consignment And Client".
(In Access 2003)

On its ReportFooter On Format event i had the line:
      Me![ImageFrame].Picture = Me![ImagePath]

While opening the report if there is no picture in the folder D:\PCTL\BarCode for the selected consignment OR you can say Control "ImagePath" is Null having Control Source "Photo".

I get Run-time error '13':
Type mismatch

On clicking Debug button i see:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
        Me![ImageFrame].Picture = Me![ImagePath] <== WITH YELLOW BACK COLOR
End Sub
~~~~~~~~~~~
I tried with the following:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If IsNull(Me![ImagePath]) Then
        MsgBox "Bar code/picture not found for this Sale Invoice." _
        , vbInformation, "PCTL Management - Information"
        Cancel = -1
    Else
        Me![ImageFrame].Picture = Me![ImagePath]
    End If
End Sub
~~~~~~~~~~~
Now opening the report I get the msgBox twice, how to get rid of msgbox displaying second time instead of once. After that the report opens with other data without picture (which is corect), except on the ReportFooter following text boxes does not display along with their labels:
CustomDeclarationNo
CustomDeclarationDate
~~~~~~~~~~~~
If the picture is available all report is OK without error.

Please help.
Regards,
Khalid


__._,_.___

Posted by: khalidtanweerburrah@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar