473,382 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Storing picture and viewing picture

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 1161
Delerna
1,134 Expert 1GB
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
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...
6
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...
3
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...
0
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...
3
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...
4
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...
2
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...
4
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...
17
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.