Sub updateSoldTo(offset As Integer)
SQL$ = "SELECT DISTINCTROW Car.MAKE, Car.MODEL, Car.YEAR, " _
& "Car.StockNo, Car.DispatchDate, soldto.SoldCustID, " _
& "Car.SoldPrice, Car.SoldDate " _
& "FROM Car INNER JOIN soldto ON Car.StockNo = soldto.SoldStockNo " _
& "Where ((soldto.soldCustID) = " & Format$(MyCustID, "###0") & ")" _
& "ORDER BY Car.DispatchDate DESC;"
Set MyRST = MyDB.OpenRecordset(SQL$)
If MyRST.RecordCount <> 0 Then
With MyRST
SMake.Text = !make
Smodel.Text = !model
SYear.Text = !Year
SStockNo.Text = !StockNo
SSoldDate.Text = Format(!SoldDate, "dd mmm yy")
If IsDate(!dispatchdate) Then
SDispatchDate.Text = !dispatchdate
Else
SDispatchDate.Text = ""
End If
SPrice.Text = "£" & !soldPrice
End With
Else
SMake.Text = ""
Smodel.Text = ""
SYear.Text = ""
SStockNo.Text = ""
SPrice.Text = ""
SSoldDate.Text = ""
SDispatchDate.Text = ""
End If
MyRST.Close
End Sub