I still not clear with you post number #6, you create two field name. What is .\PHOTO ? It is a folder name? If I have image path store in the field "Gambar" like C:\PF\GUI\ancaman padi\PENYAKIT PADI\Hawar Seludang.jpg, So What should I insert in the field name I had created ?
Code:
Image_Employment
.\PHOTO
This next one is a hardwired path
ImageProcess_Master_AdmDuesCards
F:\AdmDuesCards
This next one tells the app to use a STORED PROCEDURE to get the image from the DB
Image_Student
~GetStuPhoto_P
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim arBytes() As Byte
rs.Open "Exec " & Mid(s1, 2) & " '" & s3 & "'", gCn, adOpenForwardOnly, adLockReadOnly, adCmdText
If rs.EOF Then
rs.Close
Set rs = Nothing
End If
arBytes() = rs(0).GetChunk(rs(1))
.imgImage.Picture = PictureFromBits(arBytes())
rs.Close
Set rs = Nothing
I try to understand you code. How to start this?What is you table name?What is your field name?What the your field name data type?Do you store the image path location or the image name?
First - you should not be storing the PATH and IMAGE NAME in the same field.
Gambar should have just the image name.
GAMBAR
--------
Hawar Seludang.jpg
Hawar Bakteria.jpg
Karah.jpg
Reput Tangkai.jpg
Penyakit merah Virus.jpg
Since this is a "static" piece of information - it's what should be stored.
Now the "path" should be in a different table.
We happen to have a configuration table in our system - it's a two column table. It contains a "configuration key" and the "data value" for that key.
If you do not have a table like this already - then simply create a table called ImagePath. It would only need a single column - and will only have a single row.
To support your current path you would simply load into that table the value
C:\PF\GUI\ancaman padi\PENYAKIT PADI\
This would be the path your would store in that field.
You would grab this path - probably just once when you app loads.
And concatenate it with the image name from the field GAMBAR.
Does this make sense?
Now once you have this separation - you can change the value in the IMAGEPATH table at an install site to whatever you want.
You can then think of enhancing this to support a value of:
.\folder\subfolder
When we load a path like that we take the .\ and replace it with the APP.PATH value. That's our "shorthand" - our trigger - that tells us that the path is not a full path but instead a path off of the APP.PATH.
*** Read the sticky in the DB forum about how to get your question answered quickly!! ***
Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".
Thank you all of you. I got answer. Actually I don't know how to store the application (app.path) in the database access. Now I found that it used like this .\