Predmet:Re: Usporedba stringa
Evo ti ova procedura.
Mislim da ce ti bolje ova pasati od predhodne pa da ne popravljam nju.
PreuzmiIzvorni kôd (Visual Basic):Private Sub txtUpit_BeforeUpdate(Cancel As Integer)
Dim Rs As Recordset
Dim Db As Database
Dim Podatak(1 To 2) As String, Slicni(1 To 5) As String, Znak As String, MsgSlicni As String
Dim I As Integer, Duz As Integer, Poeni As Integer, Stanje As Single, X As Integer
Dim Poz As Integer, StartP As Integer
If IsNull(Me.txtUpit) Then GoTo Kraj
Podatak(1) = Me.txtUpit
Duz = Len(Podatak(1))
Set Db = CurrentDb
Set Rs = Db.OpenRecordset("SELECT Firma FROM TblPartneri")
Do While Not Rs.EOF
Podatak(2) = Rs.Fields(0)
For I = 1 To Duz
If I = 1 Then
StartP = 1
Else
StartP = I - 1
End If
Znak = Mid(Podatak(1), I, 1)
Poz = InStr(StartP, Podatak(2), Znak)
If Poz = I + 1 Or Poz = I Or Poz = I - 1 Then
Poeni = Poeni + 1
End If
Next I
Stanje = Poeni / Duz
Poeni = 0
Poz = InStr(1, Podatak(2), Podatak(1))
If Poz > 0 Then Stanje = 1
If Stanje > 0.7 Then
X = X + 1
Slicni(X) = Podatak(2)
End If
Rs.MoveNext
Loop
Rs.Close
If X > 0 Then
For I = 1 To X
MsgSlicni = MsgSlicni & Slicni(I) & vbCr
Next I
MsgBox "Slicni su :" & vbCr & MsgSlicni
End If
Kraj:
End Sub
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.