Dim tnames() As String = {"车751", "车457", "车789"}
For Each tname As String In tnames
Dim t As Table = Tables(tname)
Dim mindate As Date = t.Compute("min(日期)", "日期 is not null")
Dim maxdate As Date = t.Compute("max(日期)", "日期 is not null")
t.DataTable.ReplaceFor("_Sortkey", 9999, "日期 is null")
Dim i As Integer = 0
Do While mindate <= maxdate
Dim nr As Row
Dim idx As Integer = t.FindRow("日期 = #" & mindate & "#")
If idx < 0 Then
nr = t.AddNew
nr("日期") = mindate
nr("车号") = tname.Replace("车", "")
nr("支客户款") = 0
Else
nr = t.Rows(idx)
End If
nr("_Sortkey") = i
i += 1
mindate = mindate.AddDays(1)
Loop
Next