photos

kingsgambit

Registered User.
Local time
Today, 11:38
Joined
May 27, 2001
Messages
134
I put this topic in General but no response.
I have a form where the user can put a photo on,they right click and insert object etc.. is it possible to attach some code to a button that will automate this process, so the user clicks on the button and the file that contains the photos opens they select the photo and click ok and the photo is they inserted into the form.
 
1) Add the button to run code (I'll call it cmdPicture)

2) Add Microsoft Common Dialog control (find it in the ActiveX (More Controls) button on the toolbar - I'll call it cmdlgPicture)

3) In the click event of cmdPicture, (assuming the ole field is called olePicture) enter:

Me.cmdlgPicture.InitDir = "C:"
Me.cmdlgPicture.Filter = "Bitmap Image (*.bmp)| *.bmp| Icon (*.ico)| *.ico| JPEG (*.jpg)|*.jpg"
Me.cmdlgPicture.ShowOpen
Me.olePicture.SourceDoc = Me.cmdlgPicture.FileName
If Me.cmdlgPicture.FileName <> "" Then
Me.olePicture.SizeMode = acOLESizeStretch
Me.olePicture.Action = acOLECreateLink
End If


This will open a common dialog box to find the file to insert (InitDir gives the starting directory - Filter limits the types of files allowed), then inserts the selected item.

Good luck!

Scott
access_junkie@hotmail.com
 
When I tried to insert The ActiveX control, it gave a message "you do not have a license" for this.
Any ideas why?
 
Hello Scott

I have been looking for something like this to crop up and it seems to be exactly what I have been after.

I tried your example and it works great.
I added a reference number in the table also so as to tag the pic to a relevant file.
A new record button and a save button.

This now saves the record and adds at the users request.

You know whats coming now :::::

The database bloats to an enormous size.
Is it possible with the save button to save the pic to an external db or better still a designated folder, it would need some kind of way to recognise the record number.

If you have any more examples, feel free to E.Mail to me direct.

What I don't want is the user to have to enter the path manually.
Of course, manually entering the record number wouldn't be too much of a problem..

Dave
 
DW.
Is your database going to be secured?
If so I wrote a VB .exe that will allow the user to pick out an image from an external file and insert the path name into the database.
Post back if you want it.
 
Hi Nero

Perhaps thats what I need.

Please do Send it (Zipped)

Thanks

Dave
 
Scott

I'm taking a different approach.

Private Sub cmdPicture_Click()
Me.cmdlgpicture.initdir = "L:\home"
Me.cmdlgpicture.Filter = "JPEG Image(*.jpg)|*.jpg"
Me.cmdlgpicture.showopen
Me.ImagePath = Me.cmdlgpicture.filename, "Path"

If Me.cmdlgpicture.filename <> "" Then
'Me.ImageFrame.SizeMode -acollsizestretch
'Me.ImageFrame.Action = acOLECreateLink
End If

Can I get the filename path from the common dialog ?

DW
 

Users who are viewing this thread

Back
Top Bottom