thetambarineman
Technical User
Ok apologies 4 this being a bit messy..
Im slap bang in the middle of this and i need to get it out quickly.. So any help is greatly appreciated..
Basically - what i want to do is search for a sub-string from within a string - all this comes from a database which is held on a seperate form..
This is what ive got so far-
reqemployer = txtsearchemp
recsfound = 0
frmemployer.dbemployer.Recordset.MoveFirst
Do While frmemployer.dbemployer.Recordset.EOF = False
startpos = 1
fieldlen = Len(frmemployer.dbemployer.Recordset("employer_name")
stringlen = Len(reqemployer)
Do Until startpos > (fieldlen - stringlen) + 1
matchstring = Mid$(frmemployer.dbemployer.Recordset("employer_name", startpos, stringlen)
If UCase(matchstring) = UCase(reqemployer) Then
recsfound = recsfound + 1
listempnamesearch.AddItem (frmemployer.dbemployer.Recordset("employer_name")
MsgBox "Record found..."
continueflag = False
Do Until continueflag = True
DoEvents
Loop
End If
startpos = startpos + 1
Loop
If frmemployer.dbemployer.Recordset.EOF = False Then frmemployer.dbemployer.Recordset.MoveNext
Loop
end sub
this is only dev code- so thats why theres stubs- i.e. msgbox "Record found.." Later i hope to advance these a little.. Basically i want to know what im doing wrong with this code.. i cant insert an if in there anywhere to deal with not found records..
Thanks for your help..
Its all easy-im just making it hard 4 myself..
Thanks in advance..
Paul
Im slap bang in the middle of this and i need to get it out quickly.. So any help is greatly appreciated..
Basically - what i want to do is search for a sub-string from within a string - all this comes from a database which is held on a seperate form..
This is what ive got so far-
reqemployer = txtsearchemp
recsfound = 0
frmemployer.dbemployer.Recordset.MoveFirst
Do While frmemployer.dbemployer.Recordset.EOF = False
startpos = 1
fieldlen = Len(frmemployer.dbemployer.Recordset("employer_name")
stringlen = Len(reqemployer)
Do Until startpos > (fieldlen - stringlen) + 1
matchstring = Mid$(frmemployer.dbemployer.Recordset("employer_name", startpos, stringlen)
If UCase(matchstring) = UCase(reqemployer) Then
recsfound = recsfound + 1
listempnamesearch.AddItem (frmemployer.dbemployer.Recordset("employer_name")
MsgBox "Record found..."
continueflag = False
Do Until continueflag = True
DoEvents
Loop
End If
startpos = startpos + 1
Loop
If frmemployer.dbemployer.Recordset.EOF = False Then frmemployer.dbemployer.Recordset.MoveNext
Loop
end sub
this is only dev code- so thats why theres stubs- i.e. msgbox "Record found.." Later i hope to advance these a little.. Basically i want to know what im doing wrong with this code.. i cant insert an if in there anywhere to deal with not found records..
Thanks for your help..
Its all easy-im just making it hard 4 myself..
Thanks in advance..
Paul