[AccessD] overflow

Gustav Brock Gustav at cactus.dk
Wed Dec 27 05:38:32 CST 2006


Hi Pedro

You could also find the chunk, assign it to an unbound textbox, and then search that textbox:

Public Function GetMemoChunk( _
  ByVal strMemo As String, _
  ByVal strSearch As String) _
  As String

  Const clngChunk As Long = &H8000&
  
  Dim lngPos      As Long
  Dim strChunk    As String
  
  lngPos = InStr(1, strMemo, strSearch, vbTextCompare)
  If lngPos > 0 Then
  Debug.Print Int(lngPos / clngChunk)
    strChunk = Mid(strMemo, 1 + (Int(lngPos / clngChunk) * clngChunk), clngChunk)
  End If
  
  GetMemoChunk = strChunk

End Function

Then:

  Set rst = Me.RecordsetClone
  ' <Locate current record using its ID and Bookmark.>
  varMemo = rst!BigMemoField.Value
  If Not IsNull(varMemo) Then
    strChunk = GetMemoChunk(varMemo, strSearch)
    If Len(strChunk) = 0 Then
      ' Search string not found in memo.
    Else
      With Me!txtMemoSearch
        .Value = strChunk
        ' Perform search in txtMemoSearch textbox to display found string.
        ' <your search and display code>
        ' Clean up.
        .Value = Null
      End With
    End If
  End If
  rst.Close
  Set rst = Nothing

/gustav

>>> pedro at plex.nl 24-12-2006 14:14 >>>
Hello Gustav,

i don't need to edit so, how can i set the reading in chunks of 32K???

Pedro


----- Original Message ----- 
From: "Gustav Brock" <gustav at cactus.dk>
To: <accessd at databaseadvisors.com>
Sent: Sunday, December 24, 2006 12:16 AM
Subject: Re: [AccessD] overflow


> Hi Pedro
>
> You could read in the memo field in chunks of 32K until a match or the 
> last chunk is read.
> That should be fine, if all you need is to display a match. If you wish to 
> edit the text, the plot thickens ...
> /gustav
>
>
>>>> pedro at plex.nl 24-12-06 0:00 >>>
> Hello Gustav,
>
> i didn't know that.
> Can i use something else for this, or work around.
> Otherwise i have to use an other search function.
>
> Pedro
>
>
>
> ----- Original Message ----- 
> From: "Gustav Brock" <gustav at cactus.dk>
> To: <accessd at databaseadvisors.com>
> Sent: Saturday, December 23, 2006 11:47 PM
> Subject: Re: [AccessD] overflow
>
>
>> Hi Pedro
>>
>> The value of SelStart itself is limited to the max. positive value of an
>> Integer.
>>
>> /gustav
>>
>>>>> pedro at plex.nl 23-12-06 22:49 >>>
>> Hello Group,
>>
>> when using the search function below and when the position of the word
>> that is used in the search-string in field "Plaats" is above 32,767
>> (memofield), i get an runtime error 6, overflow .
>> I changed in the code: "Dim plaats As Integer" to "Dim plaats As Long",
>> but still have the same error. I don't understand why?
>>
>> Pedro Janssen
>>
>>
>>
>> ------------------code-------------------------------
>> Option Compare Database
>> Dim plaats As Integer
>>
>> Private Sub Knop21_Click()
>>
>>   If dummy <> "" Then
>>      tekstplaats = plaats
>>      If tekstplaats = 0 Then
>>         tekstplaats = 1
>>      End If
>>      INHOUD.SetFocus
>>
>>      plaats = INHOUD.SelStart + Len(dummy) + 1
>>      plaats = InStr(tekstplaats + 1, INHOUD, dummy, 1)
>>      If plaats <> 0 Then
>>         INHOUD.SelStart = plaats - 1
>>         INHOUD.SelLength = Len(dummy)
>>      Else
>>         INHOUD.SelStart = 0
>>         INHOUD.SelLength = 0
>>      End If
>>      tekstplaats = plaats
>>   Else
>>      MsgBox "Kan geen lege tekst zoeken !!", 16, "Tekst zoeken"
>>   End If
>>
>> End Sub
>>
>> ------------------/code--------------------------





More information about the AccessD mailing list