M
Mikepage5
It appears to work fine inputing the string into a text
field however it does not seem to be affecting the object
at all.
I tried to see if it would change anything if I did it
with a text field when nothing happened with the object.
When I clicked on the button, the string or path with the
correct idnum.jpg at the end appeared in the text field.
but when I attempted with the object, No change.
This is what I have inputed:
--------------------------------
Private Sub Command2_Click()
Dim StrFilePath As String
StrFilePath = "F:\dbase\EmpPics\IDPics\" & Me![idnum]
& ".jpg"
Me.scannedpicture = StrFilePath
End Sub
--------------------------------
scannedpicture is the name of the OleObject field
that I want the image to fill
field however it does not seem to be affecting the object
at all.
I tried to see if it would change anything if I did it
with a text field when nothing happened with the object.
When I clicked on the button, the string or path with the
correct idnum.jpg at the end appeared in the text field.
but when I attempted with the object, No change.
This is what I have inputed:
--------------------------------
Private Sub Command2_Click()
Dim StrFilePath As String
StrFilePath = "F:\dbase\EmpPics\IDPics\" & Me![idnum]
& ".jpg"
Me.scannedpicture = StrFilePath
End Sub
--------------------------------
scannedpicture is the name of the OleObject field
that I want the image to fill
-----Original Message-----
Hi Mike,
I think that you and Roger are basically saying the same
thing. Roger had mentioned storing the path and then
programmatically loading the image. What this means is
that every time you view a record on the form, the proper
image would be displayed (loaded) in an image object
based on either a stored path, or a path constructed from
the employee id. It seems like this is what you want to
do (unless I am also not understanding your post).
If you have an organized method of storing and naming
your images, you wouldn't even have to store the path.
You could just create the file path and name in code
running on the form's Current event, and then set that to
be the picture source for an image object.
For example (air code):
Private Sub Form_Current()
Dim StrFilePath as String
strFilePath = "X:\empdbase\emppics\" & Me![ID] & ".jpg"
Me.MyImageObject.Picture = strFilePath
End Sub
Of course, you would want to add some type of error
handler and/or check to see if a file exists, but I think
this will give you an idea of how to approach this.
The example that Roger mentioned on his website will
probably also give you more ideas.
Hope this helps.
-Ted Allen
-----Original Message-----
I do set them as linked, however I want code that will
input the ole object automatically based on a preset path
and then the [empid].jpg without the user having to go
searching for the picture everytime.very-----Original Message-----
Ordinarily, you don't store the image itself in the database. Oh sure,
Access is capable of it, but it bloats the database
quickly. A bettercalled "Picture" which illustratessolution is to store just the path to the image in the database and the
programmatically load the image into your form or report.
On my website is a small sample databasehow to do this.
--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org
Is it possible to have an access dbase ole object
automatically filled when a new record is added.
example, an employee table with employee id picture.
have an event vb procedure occur when a button is click
on that will look for a picture in a preset location
i.e. a server folder
X:\empdbase\emppics\[empid].jpg
where it automatically fills in the name of the image
based on employee id number and the image when added to
the folder is named by the id number?
I am sure that this is possible, just hoping someone may
have some clues as to how to get this to happen, My
attempts have not been successful to date.
I will add any person who assists note to the vb