codice:Public Sub agg(c As Form) ''------------------------------------------------------------------------------------ ' connessione database '------------------------------------------------------------------------------------ Dim connessione As ADODB.Connection Dim comando As ADODB.Command Dim record As ADODB.Recordset ' Set connessione = New ADODB.Connection connessione.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ= e:\db.mdb" ' Set comando = New ADODB.Command comando.ActiveConnection = connessione comando.CommandType = adCmdText Set comando1 = New ADODB.Command comando1.ActiveConnection = connessione comando1.CommandType = adCmdText ''------------------------------------------------------------------------------------ ' DICHIARAZIONI DELLE VARIABILI '------------------------------------------------------------------------------------ Dim id As Integer Dim cont As Integer cont = 0 Dim x$ Dim r1 As Integer, r2 As Integer '-------------------------------------------------------------------- 'impostazione dell id '-------------------------------------------------------------------- Dim query As String For cont = 0 To 19 Step 2 x$ = c.Label1(cont).Caption Select Case x$ Case "pluto" idx = 1 c.Text2.Text = CStr(id) End Select r1 = CInt(c.Text1(cont).Text) r2 = CInt(c.Text1(cont + 1).Text) If r1 > r2 Then query = "update tabella set c1 = c1+3, c2= c2+1, c3 = c3+1 where id = " & idx End If connessione.Execute query Next cont End Sub

Rispondi quotando