By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,925 Members | 732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,925 IT Pros & Developers. It's quick & easy.

Image Database

P: 6
I've been trying to create an image database using Access 2000 linked to all the images on our server, as per the instructions on the microsoft website.

The code to link the photos is as follows:

Private Sub Form_Current()
On Error Resume Next
If Not IsNull(Me![ImagePath]) Then
Me![Imageframe].OLETypeAllowed = 1
Me![Imageframe].SourceDoc = Me![ImagePath]
Me![Imageframe].Action = 0
End If
End Sub

Sub ImagePath_AfterUpdate()
On Error Resume Next
Me![Imageframe].OLETypeAllowed = 1
Me![Imageframe].SourceDoc = Me![ImagePath]
Me![Imageframe].Action = 0
End Sub

It then tells you to add to the properties of the 'unbound object frame'

Enabled = Yes<BR/>
Locked = No

I take it that <BR/> is By Row, so the image frame picks up the path on that row, and shows a different image per row.

The problem is that when the form/code is run all the images are referenced to the row that is clicked on/current, and when you use the properties box to try to change Yes to Yes<BR/> it won't allow the change and only allow Yes or No.

I've been trying to fix it for days can anyone help, it would be much appreciated.
Oct 5 '06 #1
Share this Question
Share on Google+
4 Replies


PEB
Expert 100+
P: 1,418
PEB
Hi

:)

In fact according your code and the unbound control object you will have ever time the current image!

I don't thinj that the problem is in <BR> I think this is a tog from Internet...

There it's sure you can't add it!

Coz it's property from type Boolean with only 2 values accepted : True or False

I suggest you to change the type of your Image as Bound Control and bound it to OLE Field in your database...

So all images will be linked in those controls! But your database will increase in size....

And the link will be enough slow 10 seconds per image! I do the same with Corel Draw! But not all images - only needed!

:)
Oct 8 '06 #2

P: 6
Thanks for all your help.

I managed to get the images to show correctly on a single form, but will only show one image on a continuous form, presumably because it only sees one record at a time as being current, by using this code:

Function setImagePath()
Dim strImagePath As String
On Error GoTo PictureNotAvailable
strImagePath = Me.txtImageName
Me.ImageFrame.Picture = strImagePath
Exit Function
PictureNotAvailable:
strImagePath = "C:\Windows\NoPicture.BMP"
Me.ImageFrame.Picture = strImagePath
End Function

then adding =setImagePath() to OnCurrent and AfterUpdate. this seems to work quite efficiently.

The idea is to be able to create a search of an image database and produce the results as a contact sheet.

I understand the problem would be the amount of images that the form could potentially generate would be too many for it to handle, but i could possibly limit the form to 10 records or maybe hide the form and go straight to a report.

Are there any ideas as to how i can get the continuous form to display many images based on the filepath saved in the corresponding record.

All your help is very much appreciated.
Jan 25 '07 #3

PEB
Expert 100+
P: 1,418
PEB
As u say this approach is good when u have single form! And u can apply it only in single form to visualize a picture!

If u want to visualize more than one picture in a form or in a report.... u need ur pictures to be in an OLE object that is bound!

I can imagine that u have all images as paths, so it isn't easy to import them!


so the only thing that i can help u is to show u the function that inserts into OLE bound control a number of wanted Corel Draw informations:

See how it is done:
I have a form and control on it:
FORM:Link_OLE
CONTROL:OLE1

Expand|Select|Wrap|Line Numbers
  1. Function link_Corel_from_liste(listes) As Integer
  2. On Error GoTo Err_link
  3. Dim draw As Object, draw1 As Object
  4. Dim mydb As Database
  5. Dim mys As Recordset
  6. Dim myr As Recordset
  7. Dim recs
  8. Dim currmys
  9. Dim p, mysr
  10. Dim xx As Long, yy As Long
  11. Dim i As Integer
  12. 'Stop
  13. Set mydb = CurrentDb()
  14. Set mys = mydb.OpenRecordset(listes) '"SELECT OAS.n°Cde AS Criteria, OAS.Pic_path AS SourceDoc, 'CorelDRAW 11.0 Graphic' AS Class, 0 AS OLETypeAllowed, '' AS SourceItem, 1 AS [Action], 3 AS SizeMode FROM OAS WHERE (((OAS.Pic_path) Like 'Y:\*')) ORDER BY OAS.n°Cde;"
  15. 'Set myr = Forms!Link_OLE.RecordsetClone
  16. If mys.RecordCount = 0 Then Exit Function
  17. mys.MoveLast
  18. mysr = mys.RecordCount
  19. currmys = 1
  20. mys.MoveFirst
  21. recs = Forms!Link_OLE.Recordset.RecordCount
  22. DoCmd.GoToRecord , "Link_OLE", acFirst
  23.  
  24. If fIsAppRunning("Corel") = False Then
  25.     Set draw1 = GetObject(mys("[Pic_path]"))
  26. End If
  27. Set draw = CreateObject("CorelDraw.Automation.11")
  28.  
  29. For p = 0 To recs - 1
  30. check_link1:
  31.     If mys("Criteria") = Forms!Link_OLE!Memo Then
  32.         draw.FileOpen mys("[Pic_path]")
  33.         draw.SelectAllObjects
  34.         'draw.Getsize xx, yy
  35.         'draw.SelectObjectsInRect -972111, 0, 2172111, 2044737, True
  36.         draw.CopyToClipboard
  37. 'Forms!Link_OLE!OLE1.Class = "CorelDRAW 11.0 Graphic"
  38.         Forms!Link_OLE!OLE1.Action = acOLEPaste
  39.         Forms!Link_OLE!OLE1.SizeMode = mys("SizeMode")
  40. '        Stop
  41. '        Debug.Print Forms!Link_OLE!OLE1.Height
  42. '        Debug.Print Forms!Link_OLE!OLE1.Width
  43. '        Forms!Link_OLE!OLE1.Height = Forms!Link_OLE!OLE1.Height * 3
  44. '        Forms!Link_OLE!OLE1.Width = Forms!Link_OLE!OLE1.Width * 3
  45.         draw.FileClose
  46.         If mysr > currmys Then
  47.             mys.MoveNext
  48.             currmys = currmys + 1
  49.         End If
  50.         DoCmd.GoToRecord , "Link_OLE", acNext
  51.         Debug.Print Now
  52.     Else
  53.         If mys("Criteria") > Forms!Link_OLE!Memo Then
  54.  
  55.         DoCmd.GoToRecord , "Link_OLE", acNext
  56.         Else
  57.             If mysr > currmys Then
  58.                 mys.MoveNext
  59.                 currmys = currmys + 1
  60.                 GoTo check_link1
  61.             End If
  62.         End If
  63.     End If
  64. Next p
  65. mys.Close
  66. mydb.Close
  67. Set draw = Nothing
  68. Set draw1 = Nothing
  69. Exit Function
  70.  
  71. Err_link:
  72. MsgBox ErrorString(Err.NUMBER)
  73. If Err.NUMBER = 2105 Then
  74.     Forms!Link_OLE.Undo
  75.     DoCmd.GoToRecord , "Link_OLE", acNext
  76. End If
  77. Resume Next
  78. End Function
  79.  
Good luck!

Thanks for all your help.

I managed to get the images to show correctly on a single form, but will only show one image on a continuous form, presumably because it only sees one record at a time as being current, by using this code:

Function setImagePath()
Dim strImagePath As String
On Error GoTo PictureNotAvailable
strImagePath = Me.txtImageName
Me.ImageFrame.Picture = strImagePath
Exit Function
PictureNotAvailable:
strImagePath = "C:\Windows\NoPicture.BMP"
Me.ImageFrame.Picture = strImagePath
End Function

then adding =setImagePath() to OnCurrent and AfterUpdate. this seems to work quite efficiently.

The idea is to be able to create a search of an image database and produce the results as a contact sheet.

I understand the problem would be the amount of images that the form could potentially generate would be too many for it to handle, but i could possibly limit the form to 10 records or maybe hide the form and go straight to a report.

Are there any ideas as to how i can get the continuous form to display many images based on the filepath saved in the corresponding record.

All your help is very much appreciated.
Jan 25 '07 #4

P: 6
Thankyou for all your help.

It may be a while before i can get to using it, restriction on my time at the moment. But i will let you know how it goes.
Jan 30 '07 #5

Post your reply

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