Selasa, 12 Januari 2016

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

 

Khalid-


.jpeg or .jpg should work just fine.  The Image control may display .pdf, but only the first page.

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 12, 2016, at 11:39 AM, khalidtanweerburrah@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,

As i replied yesterday that was a great idea to store an image in BarCode folder with the name 'NotFound.Jpg'.
It worked perfectly and then i discussed with my boss, he did not agreed that something such like should display on the report. So i simply changed the Fore Color to 'White'.

Now if there is no BarCode for any Consignment i do not get error and 'NotFound.Jpg' is used having White Fore Color so nothing written is shown there.

I do remember once you also told me to get different types of images apart from .Jpg, like .pdf I will have to check your mails to retrieve that. Because my boss saved an image with .Jpeg format.

Thanks once again,
Regards,
Khalid
 


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

John,
Good idea! i will work on it tonight.

I also gone through experimenting IFF statement but could not manage it. Is there any possibility of this to try?

Regards,
Khalid


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

Khalid-

Rather than display the annoying dialog, why not just store an image that says "Bar code / picture not found" and store it in your image directory.  Then your code would be:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If IsNull(Me![ImagePath]) Then
        Me!ImageFrame.Picture = "D:\PCTL\BarCode\NotFound.jpg"
    Else
        Me![ImageFrame].Picture = Me![ImagePath]
    End If
End Sub

Of course, your image would have to be named "NotFound.jpg".  😃


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 11, 2016, at 11:15 AM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,

It is not yet working, I am still getting msgbox displayed twice.
Khalid


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

Khalid-

No problem.  By way of explanation, the FormatCount parameter contains a counter that tells you whether this is the first or subsequent pass attempting to format the section.  For a report footer, you can get a second pass if the footer won't fit on the last page or you have set properties to force the footer to go to a new page.  It will start to format, call the event procedure, then if the section won't fit, it fires the Retreat event, updates the Format Count, and tries again on a new page.

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 11:31 AM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,

Thanks for your quick response, but i am sorry i will have to answer you tomorrow as at the moment i am at my different work place.

Thanks once again,

Regards,
Khalid


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

Khalid-

For some reason, the report engine is trying to format twice.  Do this:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If FormatCount <> 1 Then Exit Sub
    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 11:19 AM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

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: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (12)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar