469,328 Members | 1,301 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

Adding Image with Command Button

FyrJammer
I apologize if there is already a discussion about this, but I don't have a lot of time looking for it.
I need to create a command button that opens explorer to search for images to add / put into / pastes to form / bound frame. It's a database for adding pictures to property inspection form. If anyone has or knows where I can find the codes for doing such a process please let me know. I really appreciate any help.
Mar 1 '07 #1
8 11648
MMcCarthy
14,534 Expert Mod 8TB
I apologize if there is already a discussion about this, but I don't have a lot of time looking for it.
I need to create a command button that opens explorer to search for images to add / put into / pastes to form / bound frame. It's a database for adding pictures to property inspection form. If anyone has or knows where I can find the codes for doing such a process please let me know. I really appreciate any help.
Something like this will give you a get file window and return the full path to the file which can then be set to the frame.

Expand|Select|Wrap|Line Numbers
  1. Dim sFilename as String
  2. sFilename = Application.GetOpenFilename("Image Files (*.bmp),*.bmp, (*.tif),*.tif, (*.jpg),*.jpg")
  3. ' To Exit if Cancel was pressed
  4. If sFilename = "False" Then Exit Sub
  5. >
  6. >
  7.  
Mary
Mar 2 '07 #2
Something like this will give you a get file window and return the full path to the file which can then be set to the frame.

Expand|Select|Wrap|Line Numbers
  1. Dim sFilename as String
  2. sFilename = Application.GetOpenFilename("Image Files (*.bmp),*.bmp, (*.tif),*.tif, (*.jpg),*.jpg")
  3. ' To Exit if Cancel was pressed
  4. If sFilename = "False" Then Exit Sub
  5. >
  6. >
  7.  
Mary
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. Attached you will find a part of the program I'm working on. The image box is where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated.
Mar 3 '07 #3
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. I have an image box where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. Saving it as BLOB seems a little confusing to me.
The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated and thanks in advance.
Mar 3 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Thanks Mary, but is this code for my command button? I get a 'Method not recognized' error with the Application.GetOpenFilename part of the code. I have an image box where the image is going to be viewed (stored in database). I'm sorry for sounding too noobie, but I'm having a hard time figuring out how to make my button choose and save the image. Saving it as BLOB seems a little confusing to me.
The images will be relationed to specific addresses and I need to make each address have 2 images (Image1 and Image2).
Is there a way you or anyone can help me with this? Much appreciated and thanks in advance.
You are probably missing a library for the Application.GetOpenFilename. However, it sounds like you want to store the images in the database which is not what the first question said. You can link to the images using an OLE Object datatype. Create a field and set to OLE Object and follow the wizard to set it up. Link, don't embed the files.

Mary
Mar 3 '07 #5
You are probably missing a library for the Application.GetOpenFilename. However, it sounds like you want to store the images in the database which is not what the first question said. You can link to the images using an OLE Object datatype. Create a field and set to OLE Object and follow the wizard to set it up. Link, don't embed the files.

Mary
Oh, Ok. But yes, I do NEED to store the images to the database in a table because the whole database is going to be mobile via thumbdrive. My apologies for not specifying that earlier. And thanks.
Mar 8 '07 #6
i have the same situation with you .i 've just known that we have OLE bound frame on form and OLE object in database .User could insert image by right-click this control but i'm not sure it add to the right id in database .So if you have find out the way to do ,please mail to me, [email removed]. Thanks!
Mar 9 '07 #7
svill
1
I am struggling quite alot here to set the picture of an OLE object. I do have some Visual Basic experience so please dont hesitate to hit me with the technical information.

On my continous form i would like to set the OLE picture with a command button.
Intentionally there will be an open-save dialog box. But just to the raw code here to do the core function. I have not read any articles on it but this code seems to work. It only adds the icon of a bitmap file, and not the actual picture in OLE.


Me.PicturePrev.Class = "Paint.Picture"
Me.PicturePrev.OLETypeAllowed = acOLEEither
Me.PicturePrev.SourceDoc = "C:\1.bmp"
Me.PicturePrev.Action = acOLECreateEmbed
Me.PicturePrev.SizeMode = acOLESizeZoom


Please help
Aug 25 '08 #8
FishVal
2,653 Expert 2GB
Hello, all.

The most efficient way to store files (documents, pictures etc) inside database is using BLOB. There is an article in bytes.com howto's section dealing with the issue.

Kind regards,
Fish
Aug 25 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by kowald | last post: by
reply views Thread by Andrés Giraldo | last post: by
1 post views Thread by xanthviper | last post: by
9 posts views Thread by Mark Denardo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.