VBA |
Public Sub Scenario(VBAT As String, CountofPrediction As Integer) On Error Resume Next Dim rstCR As DAO.Recordset Set rstCR = CurrentDb.OpenRecordset("SELECT * FROM AllPredictsForForms") rstCR.MoveLast rstCR.MoveFirst Numberofrecords = rstCR.RecordCount J = 1 Do While Not rstCR.EOF If VBAT Then CCC = CCC + 1 'If (rstCR![Last6HomeAll] > rstCR!Last6HomeH) And (rstCR!OponentDogerforHbyAll + rstCR!OponentDogerforH) >= 4 And rstCR!LeaguePosAwayAllStatus <> 1 Then CCC = CCC + 1 CountofPrediction = CCC rstCR.MoveNext J = J + 1 Loop rstCR.Close Set rstCR = Nothing End Sub Public Function ScenarioCalculate() 'On Error Resume Next Dim CountofPrediction As Integer, VBAT As String Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("select VBAFiltertext from TeamFilters") rst.MoveLast rst.MoveFirst n = rst.RecordCount i = 1 Do While Not rst.EOF Call Scenario(rst.Fields(0), CountofPrediction) CurrentDb.Execute "update TeamFilters set CountOfPredict=" & CountofPrediction & " where VBAFiltertext=" & Chr(34) & rst.Fields(0) & Chr(34) & ";" rst.MoveNext i = i + 1 Loop rst.Close Set rst = Nothing End Function
http://www.sql.ru/forum/1288111/kak-ubrat-kavychki-s-parametra-v-vba