Default Database Folder - Images not Displaying (1 Viewer)

JoeB

New member
Local time
Today, 13:55
Joined
Nov 26, 2012
Messages
3
I have been using Access now for 15 years. I have a Database on the server drive L:\ with 2800 records - each with 6 images.

Each user has two databases - Find and ADD

I have succesfully written code to display the images on the form

Option Compare Database 'Use database order for string comparisons

Private Sub Form_Current()
If IsNull(Me![txtImageName]) Then
Me![ImageFrame].Picture = "c:\database\crest.jpg"
Else
Me![ImageFrame].Picture = Me![txtImageName]
End If

If IsNull(Me![PhotoW]) Then
Me![Photo West].Picture = ""
Else
Me![Photo West].Picture = Me![PhotoW]

End If

If IsNull(Me![PhotoN]) Then
Me![Photo North].Picture = ""
Else
Me![Photo North].Picture = Me![PhotoN]

End If

If IsNull(Me![PhotoS]) Then
Me![Photo South].Picture = ""
Else
Me![Photo South].Picture = Me![PhotoS]

End If

If IsNull(Me![PhotoE]) Then
Me![Photo East].Picture = ""
Else
Me![Photo East].Picture = Me![PhotoE]

End If
If IsNull(Me![OsScan]) Then
Me![OS Scan].Picture = ""
Else
Me![OS Scan].Picture = Me![OsScan]

End If

End Sub

This problem has only recentley happened and at this time on one Laptop only :banghead:

The "Default Database Folder" is set to L:\ - When connected to the network L:\ the images display as before

But when not connected and I open ADD - I used to get the warning "Access cannot connect to L:\" - Click on cancel Database opens and Images display

Now the Database opens without the warning but shows "Run time Error 2220 - Add cannot open forexample.jpg"

I need this to work when I am away from the Office to add new records

:banghead::banghead::banghead::banghead:
 

Simon_MT

Registered User.
Local time
Today, 13:55
Joined
Feb 26, 2007
Messages
2,177
For a start I would define the Image Directory (I store in a local table and present it to the menu)

Code:
Function GetPictureDir() As String
    GetPictureDir = Forms![Menu]![Image Directory]
End Function
Then:

Code:
Function GetPicturePathN()
    With CodeContextObject
        GetPicturePath = GetPictureDir & .[PhotoN]
    End With
End Function
Then:
Code:
Function GetPictureExistN()
        If Dir(GetPicturePathN) <> Empty Then
            GetPictureExistN = -1
        Else
            GetPictureExistN = 0
        End If
End Function
Then:
Code:
Function GetPictureN()
    With CodeContextObject
        If GetPictureExistN = True Then
            .[ImageControlN].Visible = True
            .[ImageControlN].Picture = GetPicturePathN
        Else
            .[ImageControlN].Visible = False
        End If
    End With
End Function
Simon
 

Users who are viewing this thread

Top Bottom