Results 1 to 4 of 4
  1. #1
    MLogue9 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2019
    Posts
    22

    Angry Can anyone get OCR to work? MODI fails for me.

    I need really really simple OCR to read bold very large verdana alphanumeric codes such as "L2C" or "GX45". When I try to run it as shown on one of the many sites google brought me to, it failed. I played around with the midoc.images(0).ocr, removing the .ocr method, changing the subscript to 1 and negative 1, etc but those just got me invalid procedure calls for my time. The image format is a JPEG, but I can use practically any image format as irfanview will convert via command-line and does so very fast. However, at the moment, neither JPEG or BMP are working, both throw this error:



    Method of OCR object IImage failed.

    here is the code I used:

    Code:
    Public Function OCRtest(strTempImg)
    pXname = "ocrTest"
    'On Error GoTo err_hand
    
    Dim miDoc As Object
    Dim miWord As MODI.Word
    Dim strWordInfo As String
    Set miDoc = CreateObject("MODI.Document")
    miDoc.Create strTempImg
    ' Perform OCR.
    miDoc.Images(0).ocr
    
    ' Retrieve and display word information.
    Set miWord = miDoc.Images(0).Layout.Words(2)
    strWordInfo = _
    "Id: " & miWord.ID & vbCrLf & _
    "Line Id: " & miWord.LineId & vbCrLf & _
    "Region Id: " & miWord.RegionId & vbCrLf & _
    "Font Id: " & miWord.FontId & vbCrLf & _
    "Recognition confidence: " & _
    miWord.RecognitionConfidence & vbCrLf & _
    "Text: " & miWord.Text
    
    Set miWord = Nothing
    Set miDoc = Nothing
     
    OCRtest = strWordInfo
    Return
    Exit Function
    err_hand:
    Call CStatus(Error, 504, Err.Number, Err.description, strTempImg)
    End Function

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Bing: Access VBA ocr

    I see you have been trying to solve this for quite some time https://stackoverflow.com/questions/...access-via-vba

    I found statements that MODI should work for 2007 but not supported in 2010.

    Found solutions that involved reading PDF or converting PDF to TIF.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MLogue9 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2019
    Posts
    22
    I installed MODI a while ago, made sure that the correct lib was loaded, and ran it and it promptly crashed Access 2007! Yes I've been on and off it for a year.

  4. #4
    MLogue9 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2019
    Posts
    22
    I was OP on that thread

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Macro button fails to work
    By Lou_Reed in forum Access
    Replies: 1
    Last Post: 10-30-2017, 03:02 PM
  2. Replies: 4
    Last Post: 12-06-2014, 08:49 PM
  3. SQL Insert Into Fails
    By Randy in forum Access
    Replies: 2
    Last Post: 12-14-2012, 05:26 PM
  4. query fails
    By rjjhome in forum Queries
    Replies: 4
    Last Post: 03-15-2012, 05:19 PM
  5. MODI Viewer Control
    By TomBra in forum Programming
    Replies: 0
    Last Post: 04-03-2009, 02:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums