Dim strsql As String
Dim rst As New ADODB.Recordset
strsql = "select * from LD_COLOUR_HISTORY where (hld='" & HLD.Value & "') and (colour='" & Colour & "')"
rst.Open strsql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
Dim i As Integer, dt1 As Date, dt2 As Date
Do Until rst.EOF
i = i + 1
If UCase(rst("event")) Like "*REC*" Then dt1 = rst("date")
If UCase(rst("event")) Like "*SUB*" Then dt2 = rst("date")
rst.MoveNext
Loop
MsgBox DateDiff("d", dt1, dt2) / (i / 2)
我想将if ucase(rst("event")) like "*SUB*" then dt2=rst("date")改为查找这个“*SUB*”最后一次出现的记录。不知怎么改?
请各位帮我看看!!!
[em26]
[em26]