UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
3 Pages V < 1 2 3 >  (Go to first unread post)
   Reply to this topicStart new topic
> Storing Pictures In Access - How Big Can They Be?, Access 2016    
 
   
ADezii
post Sep 18 2019, 09:48 AM
Post#21



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


I have attached the Demo for you for your review. Please keep in mind that it is a work-in-progress and it does rely on the API for some of it's functionality. If you wish, you can remove all of the API related Code and replace it with a Office File Dialog for the File Browse, an Office Folder Dialog for the Find Folder, hard coded Path for the create Temporary Folder to work in, etc. I honestly do not have the time right now for the conversion but I'm sure you will be able to accomplish it yourself. Good Luck with your Project.
Attached File(s)
Attached File  BLOB_Demo_3.zip ( 639.26K )Number of downloads: 3
 
Go to the top of the page
 
ordnance1
post Sep 19 2019, 11:38 AM
Post#22



Posts: 692
Joined: 7-May 11



Well I certainly appreciate all your time and effort.

When I click on the Browse for Graphic Files, nothing happens. I went so far as to try on another computer, but same result.
Go to the top of the page
 
ordnance1
post Sep 19 2019, 11:40 AM
Post#23



Posts: 692
Joined: 7-May 11



I should note that all other buttons function properly.
Go to the top of the page
 
ADezii
post Sep 19 2019, 11:51 AM
Post#24



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


It must have to do with the API References, as soon as I get a change I'll remove all of the API references from this File Dialog and replace it with something simpler, probably the Office File Dialog.
Go to the top of the page
 
ordnance1
post Sep 19 2019, 12:21 PM
Post#25



Posts: 692
Joined: 7-May 11



A t your convenience, you have invested a lot of time in this.
Go to the top of the page
 
ADezii
post Sep 19 2019, 01:37 PM
Post#26



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


  1. I have completely eliminated the overwhelming majority of API Code except for the ShellExecute() API Function. The reason for this is that the DB can Edit any Graphic Image without knowing what Application Opens that File. This Function will Open any File based solely on its Extension, associating the Extension with the Server Application that will Open it. This information is stored in the System Registry.
  2. You will now need a Reference to the Microsoft Office XX.X Object Library since the Office File and Folder Dialogs now replace a large amount of API Code.
  3. Give it a try and let me know how you make out.

Attached File(s)
Attached File  BLOB_Demo_4_No_API.zip ( 638.66K )Number of downloads: 4
 
Go to the top of the page
 
ordnance1
post Sep 19 2019, 03:15 PM
Post#27



Posts: 692
Joined: 7-May 11



We have success. I am checking it out now.

Thank you for all your time and effort!
Go to the top of the page
 
ordnance1
post Sep 19 2019, 04:28 PM
Post#28



Posts: 692
Joined: 7-May 11



I am able to do the import, but currently each import is overwriting the current image.

Disregard. If I go down to the navigation button and select new record it works as expected.
This post has been edited by ordnance1: Sep 19 2019, 04:49 PM
Go to the top of the page
 
ordnance1
post Sep 19 2019, 05:40 PM
Post#29



Posts: 692
Joined: 7-May 11



Just wondering if the temp folder can be c:\TempImage
Go to the top of the page
 
ADezii
post Sep 19 2019, 06:22 PM
Post#30



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


QUOTE
Just wondering if the temp folder can be c:\TempImage

Wherever you see the Code Line
CODE
msTemporaryFolder = getTempFolder & "\"

replace it with
CODE
msTemporaryFolder = "C:\TempImage\"

or more simply done (reference Graphic)
P.S. - Sorry for the Dups, don't really know what happened.
This post has been edited by ADezii: Sep 19 2019, 06:35 PM
Attached File(s)
Attached File  Replace.JPG ( 32.44K )Number of downloads: 0
 
Go to the top of the page
 
ADezii
post Sep 19 2019, 06:22 PM
Post#31



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


CODE
msTemporaryFolder = getTempFolder & "\"

with
CODE
msTemporaryFolder = "C:\TempImage\"
Go to the top of the page
 
ADezii
post Sep 19 2019, 06:23 PM
Post#32



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


CODE
msTemporaryFolder = getTempFolder & "\"

with
CODE
msTemporaryFolder = "C:\TempImage\"
Go to the top of the page
 
ordnance1
post Sep 19 2019, 07:43 PM
Post#33



Posts: 692
Joined: 7-May 11



I can't express effectively how invaluable your help has been in this.

I was looking to insert some word documents as well and added the docx extension. but if does not appear in the file type box.

Attached File  Untitled_picture.png ( 68.61K )Number of downloads: 1


Attached File  Untitled_picture.png ( 68.61K )Number of downloads: 0
Go to the top of the page
 
ADezii
post Sep 19 2019, 07:46 PM
Post#34



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


  1. Before you do anything, just a quick question. By 'Temp Folder' I assume that you are you referring to the Working Folder which is a Temporary Folder created by the File Scripting Runtime Library?
  2. As a Reply to your previous question
    QUOTE
    Blobs are typically used to store Images, Audio or other Multimedia Objects, not Word Files.

This post has been edited by ADezii: Sep 19 2019, 07:53 PM
Go to the top of the page
 
ordnance1
post Sep 19 2019, 07:58 PM
Post#35



Posts: 692
Joined: 7-May 11



10-4 thanks
Go to the top of the page
 
ordnance1
post Sep 20 2019, 08:01 AM
Post#36



Posts: 692
Joined: 7-May 11



Is PDF an option? I would like to archive related documents within the db.
Go to the top of the page
 
ordnance1
post Sep 20 2019, 08:58 AM
Post#37



Posts: 692
Joined: 7-May 11



Having spent a considerable number of hours in Google I am now able to save both docx and pdf formatted documents. What my issue was. was that they do not display in thew image box, but I can work with that.
This post has been edited by ordnance1: Sep 20 2019, 09:00 AM
Go to the top of the page
 
ADezii
post Sep 20 2019, 05:06 PM
Post#38



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


You can Save Objects, in this case *.doc, *.docx, and *.pdf by by Inserting them with Code into a Bound Object Frame (not Image Control) which is Bound to an underlying OLE Object Field. The Embed Demo will allow you to select either Word Documents or PDF Files which will then be Embedded into the Bound Object Frame and saved to the underlying Table. These Objects are Embedded and not Linked, the fact that you can view them at all is proof that they are not Linked. Click the Command Button, select a File and see what happens either a New Record will be created or an existing Record edited. Integrating this approach into the existing Framework of Storing BLOBs into the same OLE Object Field will be difficult to say the least. Also keep in mind that you currently have a 1 to 1 Relationship, for each Record in the Main Table there is a single BLOB in the Child Table. You would then have to allow for multiple BLOBs as well as Multiple Documents to be stored in the Child Table creating a 1 to MANY Relationship. Dbl-Click the Document in the Bound Object Frame to auto-activate it. This is getting more complicated by the minute. iconfused.gif
Attached File(s)
Attached File  Embed.zip ( 1.31MB )Number of downloads: 3
 
Go to the top of the page
 
ADezii
post Sep 20 2019, 07:09 PM
Post#39



Posts: 2,689
Joined: 4-February 07
From: USA, Florida, Delray Beach


NOTE: Set the Verb Property of the Bound Object Frame = -2 to 'Open' the Server App associated with the File's Extension.
This post has been edited by ADezii: Sep 20 2019, 07:09 PM
Go to the top of the page
 
ordnance1
post Sep 22 2019, 12:14 PM
Post#40



Posts: 692
Joined: 7-May 11



Sorry to keep bothering you, but, I have been spending time modifying the code to work for my situation and for the most part have been successful. I have hit 1 stumbling block.

I will be using SQL Server as the back end, and the process of importing individual image files works fine. When I attempt yo use the Bulk Import I get the following error:

Attached File  Untitled_picture.png ( 68.61K )Number of downloads: 1


I have attempted to add dbSeeChanges to line
CODE
Set rs = CurrentDb.OpenRecordset("dbo_BlobInventory", dbOpenDynaset, dbAppendOnly)


This required me to remove dbAppendOnly

But then I get an error "item not found in collection" and rs![Item Name] = strFile is highlighted


CODE
Private Sub Command53_Click()
'''On Error GoTo Err_Command53_Click
Dim strFile As String
Dim intCtr As Integer
Dim rstBLOB As ADODB.Recordset
Dim rs As DAO.Recordset
Dim mstream As ADODB.Stream
Dim strFolder As String
Dim dlgOpen As Office.FileDialog
Dim intResponse As Integer
Dim intCtr2 As Integer

Set dlgOpen = Application.FileDialog(msoFileDialogFolderPicker)

With dlgOpen
  .AllowMultiSelect = False
  .ButtonName = "Select Import Folder"
  .Title = "Browse for Folders"
  .InitialView = msoFileDialogViewLargeIcons
  .InitialFileName = "C:\BLOB_Storage\"
    If .Show <> -1 Then Exit Sub
      strFolder = .SelectedItems(1) & "\"
End With

intResponse = MsgBox("Import Graphics from " & strFolder & "?", vbQuestion + vbYesNo, "Import Prompt")
If intResponse = vbNo Then Exit Sub

'''Set rs = CurrentDb.OpenRecordset("dbo_BlobInventory", dbOpenDynaset, dbSeeChanges)
Set rs = CurrentDb.OpenRecordset("dbo_BlobInventory", dbOpenDynaset, dbAppendOnly)


Set rstBLOB = New ADODB.Recordset


'''rstBLOB.Open "dbo_BlobStorage", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, dbAppendOnly
rstBLOB.Open "dbo_BlobStorage", CurrentProject.Connection, adLockOptimistic



intCtr = 1
strFile = Dir(strFolder & "*", vbNormal)

Set mstream = New ADODB.Stream

DoCmd.Hourglass True

Do While strFile <> ""
  If fIsGraphicFile(strFile) Then
   intCtr2 = intCtr2 + 1
    rs.AddNew
      rs![Item Name] = strFile
      rs![ItemDescription] = "Description for File: " & CStr(intCtr)
    rs.Update
    rs.Bookmark = rs.LastModified   'for Last [BlobInventory_ID]

    With mstream
      .Type = adTypeBinary
      .Open
      .LoadFromFile strFolder & strFile
    End With
    With rstBLOB
      .AddNew
        .Fields("BlobInventory_ID").Value = rs![BlobInventory_ID]     'Child Record
        .Fields("sFileName") = strFolder & strFile
        .Fields("sFileExtension") = Mid$(strFile, InStrRev(strFile, "."))
        .Fields("oPicture").Value = mstream.Read
      .Update
    End With
    mstream.Close: intCtr = intCtr + 1
  End If
    strFile = Dir
Loop

rstBLOB.Close
Set rstBLOB = Nothing

If (intCtr - 1) = 0 Then
  MsgBox "There were no Graphic Files in the Folder [" & strFolder & "]", vbExclamation, "No Graphic Files"
Else
  MsgBox CStr(intCtr2) & " Graphic Files were Imported from " & strFolder & ".", _
         vbInformation, "Import Status"
  Me.Requery
End If

Exit_Command53_Click:
  DoCmd.Hourglass False
    Exit Sub

Err_Command53_Click:
  MsgBox Err.Description
    Resume Exit_Command53_Click
End Sub


Go to the top of the page
 
3 Pages V < 1 2 3 >


Custom Search


RSSSearch   Top   Lo-Fi    15th November 2019 - 03:19 AM