errata corrige prima :gren:



on error resume next
strSQL = "SELECT * FROM gestione_merce WHERE id = " & id & " order by ID1 Desc"
Set rstFieldData = New ADODB.Recordset
With rstFieldData
CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open Source:=strSQL, _
ActiveConnection:=cnnConnect, _
Options:=adCmdText
End With
if err.number = 3021 then
control = "ok"
end if
Dim val1 As Integer
Dim val2 As Integer
Dim val3 As Integer
If control = "ok" Then
val1 = Me.numero_confezioni.Value
val2 = Me.unita_per_confezioni.Value
If val1 <> 0 Then
Me.totale_carico.Value = val1 * val2 + val3
Else
Me.totale_carico.Value = val2 + val3
End If
Else
val3 = rstFieldData(8)
If val1 <> 0 Then
Me.totale_carico.Value = val1 * val2 + val3
Else
Me.totale_carico.Value = val2 + val3
End If
End If

End Sub

cosi dovrebbe funzionare e dovrebbe essere anche lubrificato :gren: