Prikazi cijelu temu 18.02.2012 16:26
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re: Usporedba stringa
Evo probaj sa ovim
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub txtUpit_BeforeUpdate(Cancel As Integer)
  5. Dim UpitT As String, Slovo As String * 1, Uslov As String
  6. Dim mySQL As String
  7. Dim rs As Recordset
  8. Dim Db As Database
  9. Dim Brojac As Integer, Reper As Integer
  10. Dim I As Integer
  11. Dim Str As String
  12.  
  13.  
  14. UpitT = Me.txtUpit & "*"
  15.  
  16. Str = "/.q,'- "
  17. Brojac = Len(UpitT)
  18.  
  19. For I = 1 To Brojac
  20. Slovo = Mid(UpitT, I, 1)
  21. Reper = InStr(1, Str, Slovo)
  22. If Reper > 0 Then
  23. Uslov = Uslov & "*"
  24. Else
  25. Uslov = Uslov & Slovo & "*"
  26. End If
  27. Next I
  28. Set Db = CurrentDb
  29. mySQL = "SELECT * FROM qryPartneri WHERE Firma Like '" & Uslov & "'"
  30. Set rs = Db.OpenRecordset(mySQL)
  31. If rs.RecordCount > 0 Then
  32. MsgBox UpitT & " Podatak postoji"
  33. Else
  34. MsgBox UpitT & " Podatak ne postoji"
  35. End If
  36. End Sub

Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.