VB6 OverFlow problem

  • From: "Geoff Smith" <gc.smith@xxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 8 Oct 2009 15:55:26 +0100

Hello All,

I realise there aren't many people using VB6 these days, but can anyone help me 
with this irretating problem?

In short blocks of text in an MSAccess memo type field I can use the code below 
to search text, but anything longer than 3/4 thousand characters, I'm getting 
an overflow message with an error 6. When I click on the OK button, the 
programme bombs.

The Code is:

Private Sub mnuNavSearchText_Click()
Dim strMainString As String
Dim intLengthOfString As Integer
Dim intWheresTheString As Integer

' Assigning the variables
strMainString = txtTB(4) ' String1, String  to be searched
intLengthOfString = Len(strMainString) ' Length of string to be searched

M_strSearchFor = InputBox$("Search for Text, ", , "")

intWheresTheString = InStr(strMainString, M_strSearchFor) ' Arguements employed

If intWheresTheString Then ' If string found
txtTB(4).SelStart = intWheresTheString - 1  'Start the selection and
txtTB(4).SelLength = Len(M_strSearchFor)  ' set selection length
MsgBox "String Found" ' Notify user of successful result
Else ' or
MsgBox "String not found" ' notify user of the resulting failure
txtTB(4).SetFocus
End If
End Sub

The Outlook Express window seems to have made a bit of a mess of the code, 
spilling some lines onto two lines.

Can anyone see what is happening? I'd be very grateful for any help.

Geoff
Email: gc.smith@xxxxxxxxxx

Other related posts: