Predmet:Re: Pretraga
evo novi kod
PreuzmiIzvorni kôd (Visual Basic):Private Sub Command17_Click()
Dim SQL As String, Kriterij As String, RecordSource As String
Dim Brojac As Integer
SQL = "SELECT * FROM Imenik"
Kriterij = ""
Dodaj_Kriterij Me.Text11, "(ime & ' ' & prezime)", Kriterij, Brojac
Dodaj_Kriterij Me.Text18, "grad", Kriterij, Brojac
If Kriterij <> "" Then
Kriterij = " WHERE " & Kriterij
End If
RecordSource = SQL & Kriterij
Me.RecordSource = RecordSource
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Nema podataka"
End If
End Sub
Private Sub Dodaj_Kriterij(VrijednostPolja As Variant, ImePolja As String, Kriterij As String, Brojac As Integer)
If VrijednostPolja <> "" Then
If Brojac > 0 Then
Kriterij = Kriterij & " AND "
End If
Kriterij = (Kriterij & ImePolja & " Like " & Chr(39) & VrijednostPolja & Chr(42) & Chr(39))
Brojac = Brojac + 1
End If
End Sub
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.