Predmet:Re: Usporedba stringa
Evo probaj sa ovim
PreuzmiIzvorni kôd (Visual Basic):Option Compare Database
Option Explicit
Private Sub txtUpit_BeforeUpdate(Cancel As Integer)
Dim UpitT As String, Slovo As String * 1, Uslov As String
Dim mySQL As String
Dim rs As Recordset
Dim Db As Database
Dim Brojac As Integer, Reper As Integer
Dim I As Integer
Dim Str As String
UpitT = Me.txtUpit & "*"
Str = "/.q,'- "
Brojac = Len(UpitT)
For I = 1 To Brojac
Slovo = Mid(UpitT, I, 1)
Reper = InStr(1, Str, Slovo)
If Reper > 0 Then
Uslov = Uslov & "*"
Else
Uslov = Uslov & Slovo & "*"
End If
Next I
Set Db = CurrentDb
mySQL = "SELECT * FROM qryPartneri WHERE Firma Like '" & Uslov & "'"
Set rs = Db.OpenRecordset(mySQL)
If rs.RecordCount > 0 Then
MsgBox UpitT & " Podatak postoji"
Else
MsgBox UpitT & " Podatak ne postoji"
End If
End Sub
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.