Hi Folks,

Can anybody help here, all seems good but am unfamiliar wuth summing a value on a recordset and then turfing it out - see last few lines of code!

Thanks

Code:
Option Explicit
Private Sub Workbook_Open()
Dim Finalrow As Variant
Dim i As Integer
Dim JobNo As Variant

Dim objConnection As Object
Dim objRecordset As Recordset

Finalrow = Range("A65536").End(xlUp).Address
    Finalrow = Right(Finalrow, 2)
    
    For i = 1 To Finalrow
 JobNo = Cells(i, 1).Value
 
On Error Resume Next

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H1

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")

objConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=U:\Radii\LOGS\Purchase Order Log.xls;" & _
        "Extended Properties=""Excel 8.0;HDR=Yes;"";"

objConnection.Open
objRecordset.Open "SELECT Sum POVALUEexclVAT, FROM [Log$] WHERE PROJECTNUMBER = '" & JobNo & "'", objConnection, adOpenStatic, adLockOptimistic, adCmdText

'Cells(i, 2).value = 'value of the summed recordset

Next i

End Sub
Thanks