Images, path and flashdrive issue

suyoheros

New member
Local time
Today, 15:54
Joined
Aug 26, 2015
Messages
2
Hi, people,
I'm new in the forum, still I browse google after Access articles and always tumble, here. =] To my question:

In my new database, I'm doing with images. Each record has one PNG file associated, and the way I found to do the association comes from a field in my table that has the physical adress in a flashdrive. The reason the database it's in a flashdrive is cause I want some mobility of the database, from a computer to other, and so on. I've learned a VBA code that takes the field containing the path (carta_imagem) and associate it to a empty image object (cartapic) in a form. This is the code:

Private Sub Form_Current()

cartapic.Picture = carta_imagem

End Sub

The path its something like "G:\whatever\what\who\where\00.png", where the file name logically changes for each record. However, when I change the flashdrive from computer, the volume letter may change too, what brings "2220 error".

I've tried change the beggining of the path to "\\whatever\what\who\where" (two backslashs), like I saw on the video that explained the image linking, but no luck. I really believe this is a path issue, but with code envolved, I tought was best bring it to this code thread. Sorry for the long post, guys, and thank you, for any help you can give me.
 
Welcome to the Forum! :)


Hmm, if it were me I would create a Table...

Code:
tblSettings
sID (PK, Autonumber)
sFlashDrive (Text, 3)

In the field sFlashDrive inter C:\ or whatever the Drive Letter is at the machine you are at.

Then...

Code:
Private Sub Form_Current()
 
     Dim strFlashDrive As String
 
     strFlashDrive = DLookup("sFlashDrive","tblSettings","sID = 1")  'Or whatever the PK is
     cartapic.Picture = strFlashDrive & carta_imagem
 
End Sub

Oh, and remember you need to remove the first three characters from the field that stores the entire path.
 
Last edited:
Hi, Gina! Thanks for the fast reply!

Hey, worked wonderfully! I've made a test, copying the folder to a identical path at the hard disk and worked too. I think the final test will be when the flashdrive letter changes to a different (here, at the office, they're always "G:\" for my flashdrive).
I'll let you know, if it happens, but, for now, thank you so much!! =]
 
I think the final test will be when the flashdrive letter changes to a different

The drive letter can be nominated in Windows.
Administrative Tools > Computer Management > Storage > Disk Management

Right click on the drive and select "Change Drive Letter and Paths".
 

Users who are viewing this thread

Back
Top Bottom