Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Policz(ByVal p_dzien as String, ByVal p_nazwa as String) as Integer
- Dim a1 as DAO.Recordset
- Dim a2 as DAO.Recordset
- Dim a3 as DAO.Recordset
- Dim a4 as DAO.Recordset
- Dim nr as Integer
- Dim kryt as String
- Dim war1 as Integer
- Dim war2 as Integer
- Dim prz as Integer
- Dim wynik as Integer
- Set a1 = CurrentDb.OpenRecordset("PRZEDMIOTY",DbOpenSnapshot)
- kryt = "NAZWA_PRZEDM = '"&p_nazwa
- a1.FindFirst kryt
- if a1.NoMatch Then
- Policz = 0
- Exit Function
- Else
- Set a2 = CurrentDb.OpenRecordset("ROZKLADY",DbOpenSnapshot)
- kryt = "NR_PRZEDM = '"&nr&"' AND DZIEN = '"&p_dzien
- a2.FindFirst kryt
- Do until a2.NoMatch
- war1 = 1+war1
- a2.FindNext
- Loop
- End if
- a1.FindNext
- Loop
- Set a3 = CurrentDb.OpenRecordset("PRZEDMIOTY",DbOpenSnapshot)
- a3.MoveFirst
- Do untila3.EOF
- prz = a3![NR_PRZEDM]
- kryterium = "NR_PRZEDM = '" &prz&'" AND DZIEN = '"&p_dzien
- Set a4 = CurrentDb.OpenRecordset("ROZKLADY",DbOpenSnapshot)
- a4.FindFirst kryt
- war2 = war2+1
- a4.FindNext
- Loop
- if war2>war1 Then
- wynik = 1+wynik
- End if
- a3.MoveNext
- Loop
- Policz = wynik
- Exit Function
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement