[ eli @ 26.03.2002. 02:12 ] @
Zanima me kako bi se mogao napraviti brojac u Accessu koji bi prilikom unosa podakata u jednu formu brojao koliko puta se unese broj 1, 2 i 3 u jedno polje, i kad unesemo recimo broj 1 cetiri puta, da dobijem poruku da je broj jedan unijet cetri puta i da brojac ponovo pocne brojati nove cetri 1 ili 2 ili 3
[ Simke @ 13.04.2002. 00:42 ] @
Ako sam dobro shvatio pitanje, ovo je otprilike sta ti treba.
Potreban su ti dva event-a, before update za text box gde unosis broj, i on activate za form. On activate event samo resetuje brojace svaki put kada se form otvori.

Option Compare Database
Option Explicit

Dim intBrojacJedan As Integer
Dim intBrojacDva As Integer
Dim intBrojacTri As Integer

Private Sub Broj_BeforeUpdate(Cancel As Integer)

Dim intTrenutniBroj As Integer

intTrenutniBroj = Me.Broj.Text

If intTrenutniBroj = 1 Then
intBrojacJedan = intBrojacJedan + 1
If intBrojacJedan = 4 Then
MsgBox ("Broj jedan unet cetiri puta")
End If
End If

If intTrenutniBroj = 2 Then
intBrojacDva = intBrojacDva + 1
If intBrojacDva = 4 Then
MsgBox ("Broj dva unet cetiri puta")
End If
End If

If intTrenutniBroj = 3 Then
intBrojacTri = intBrojacTri + 1
If intBrojacTri = 4 Then
MsgBox ("Broj tri unet cetiri puta")
End If
End If

End Sub

Private Sub Form_Activate()

intBrojacJedan = 0
intBrojacDva = 0
intBrojacTri = 0

End Sub