Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

no photo found... what now?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jean-Paul De Winter - 18 Nov 2005 20:57 GMT
I wrote following code:

Private Sub Form_Current()
    If IsNull(Me!foto) = False Then
        Me![fotoken].Picture = Me![foto]
    Else
        Me![fotoken].Picture = "c:\DBI\logo.jpg"
    End If
End Sub

This works just great now but, I get an errormessage when no photo is
found in the corresponding path.
Could you please explain what I should write to avoid this?
Maybe something like setting the image.visible to false or whatever.

Thanks
JP
Douglas J. Steele - 18 Nov 2005 22:34 GMT
Assuming that Me![foto] contains the path to the (missing) photo, try:

Private Sub Form_Current()
    If IsNull(Me!foto) = False Then
        If Len(Me![foto]) > 0 Then
           Me![fotoken].Picture = Me![foto]
        Else
           Me![fotoken].Picture = "c:\DBI\logo.jpg"
        End If
    Else
        Me![fotoken].Picture = "c:\DBI\logo.jpg"
    End If
End Sub

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I wrote following code:
>
[quoted text clipped - 13 lines]
> Thanks
> JP
Jean-Paul De Winter - 19 Nov 2005 07:45 GMT
> Assuming that Me![foto] contains the path to the (missing) photo, try:
>
[quoted text clipped - 9 lines]
>      End If
> End Sub

I don't think this will work...
If len(Me!foto)> 0 but the path to to the photo is wrong so the photo
can't be found (deleted as ex.) what then?
Thnaks
Douglas J. Steele - 19 Nov 2005 12:08 GMT
Sorry: typing too quickly.

Rather than Len(Me![foto]) > 0, it should be Len(Dir(Me![foto])) > 0

The Dir function returns the name of the file (no path) if the file exists,
or an empty string if it doesn't.

My apologies for the confusion.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>> Assuming that Me![foto] contains the path to the (missing) photo, try:
>>
[quoted text clipped - 14 lines]
> can't be found (deleted as ex.) what then?
> Thnaks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.