473,549 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing picture and viewing picture

7 New Member
I am trying to adopt the code below to store a picture file in a table filed so that i can view it any time i open the form with its control. However, this code did not do that. When i loaded the picture quite well its path was saved in the table field but after i close the form and reopen it i could not see the picture. How can i always make the picture viewable.

The form name is frmComment
The table has two fields: ItemID and PicFile

Expand|Select|Wrap|Line Numbers
  1. ---------------
  2. Private Sub cmdAddPicture_Click()
  3. Dim OFN As OPENFILENAME
  4. On Error GoTo Err_cmdAddPicture_Click
  5.  
  6. ' Set options for dialog box.
  7. With OFN
  8.   .lpstrTitle = "Images"
  9.   If Not IsNull([PicFile]) Then .lpstrFile = [PicFile]
  10.   .flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist +   OFN_HideReadOnly
  11.   .lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)",  "*.bmp;*.gif;*.jpg;*.wmf", _
  12. "All files (*.*)", "*.*")
  13. End With
  14.  
  15. If OpenDialog(OFN) Then
  16.   [PicFile] = OFN.lpstrFile
  17.   Forms!frmComment![imgPicture].Picture = [PicFile]
  18.   SysCmd acSysCmdSetStatus, "Afbeelding: '" & [PicFile] & "'."
  19. End If
  20. Exit Sub
  21.  
  22. Err_cmdAddPicture_Click:
  23.   MsgBox Err.Description, vbExclamation
  24. End Sub
Apr 9 '08 #1
1 1172
Delerna
1,134 Recognized Expert Top Contributor
Hi
Part of your subroutine will need to save the path to the picture into a table.

Then you will need to add code to the form_load event that reads the path that you stored earlier and then sets the picture property of the image to that, just like you have in your code here
Apr 9 '08 #2

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

Similar topics

6
1879
by: dave | last post by:
Hello, I've got a situation where a page has a picture on it. This picture is linked to in a newsgroup posting. The owner of the site wants to know how many times the picture is viewed from the newsgroup, it is a small pic about 74k if that matters and stored locally on the server, not a link that he's pulling in from another site. Thanks....
6
3038
by: bissatch | last post by:
Hi, I am currently writing a news admin system. I would like to add the ability to add images to each article. What I have always done in the past is uploaded (using a form) the image to a folder on the server and then in the database table that I INSERT the news article, I'll store the path of the uploaded image. To me this seems a...
3
10572
by: bissatch | last post by:
Hi, I am wanting to learn how to store images in a postgreSQL database. I have got as far as uploading the file using a file/browse field on an html form and have been able to catch the file using $_FILES. What I dont know is how to to them store the image in a database. Can someone please supply the code required to do this? Also, what is...
0
917
by: Mark T. | last post by:
Hi all, I have a form on which I have three unbound object frames. Usually the pictures display on the form when I drag and drop them into the frames in Form View. Something has changed so that now when I drag a picture to the frame, it only displays the name of the picture. Then when I try to view the report, I also only get the name of...
3
5354
by: anewbie | last post by:
hi. ive been searching for help with storing images in access. after much hunting i found this bit of code that Cor Ligthert put up on another forum. but when i try to update to the dataset, i get this error: system.argument. exception in system.data.dll, cannot change data type of a column once it has data. for one thing my column is...
4
3551
by: najimou | last post by:
Hi everyone I have a form that displays images, what i want to do is that when the user double clicks on the picture displayed, it opens in MS picture manager I used the code: shell "ois.exe me!" what happens here, picture manager flashes then disappears from the screen
2
2800
by: kentgorrell | last post by:
I had a wonderful time working out how to read and write BLOBs using GetChunk until I found the new streaming object in ADO 2.6 very easy. Now I am confronted with DIBs The code I have is VB6 but only partial so I can't actually run it. Anyhow I need to get it to work in Access but there are a couple of properties and methods of the picture...
4
5815
by: =?Utf-8?B?Q2FybGFKYWRl?= | last post by:
Can anyone help me? I need to use picture it 2000 every day and use to use it on Windows XP and had NO problems at all. If I would open up windows explorer i could be in my folder that has all of my picture it files in there, .mix files and even though they were not jpegs etc.. windows explorer would show the thumbnail of all of these...
17
12046
by: merrily | last post by:
Read in one forum the question someone asked after successfully (sort of) installing Picture It 2000 on new computer with Vista. Will this person or any other help me accomplish this install on Vista, please. I tried installing Picture It and it seemed to do so. I got no error messages but it sure took a long time. Then when I tried to open...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7808
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.