select ta.* from 交款记录 ta, 交款记录 tb where ta.累交定金 < (select MAX(tb.累交定金) from tb where tb.销售编号= '" & f & "'")
BenBenBoy(独孤小新) ,用你的方法会提示“对象名 tb 无效”
改成以下 g = "select 交款记录.* from 交款记录 where 累交定金 < MAX(select 累交定金 from 交款记录 where 交款记录.销售编号= '" & f & "') group by 累交定金" adors.Open g, adoconn, adOpenKeyset, adLockOptimistic If adors.RecordCount > 0 Then adors.Delete adors.Requery End If
再改成以下 g = "select 交款记录.* from 交款记录 where 累交定金 < MAX(select 累交定金 from 交款记录 where 交款记录.销售编号= '" & f & "' group by 累交定金" )
from 交款记录 ta, 交款记录 tb
where ta.累交定金 <
(select MAX(tb.累交定金)
from tb
where tb.销售编号= '" & f & "'")
g = "select 交款记录.* from 交款记录 where 累交定金 < MAX(select 累交定金 from 交款记录 where 交款记录.销售编号= '" & f & "') group by 累交定金"
adors.Open g, adoconn, adOpenKeyset, adLockOptimistic
If adors.RecordCount > 0 Then
adors.Delete
adors.Requery
End If
g = "select 交款记录.* from 交款记录 where 累交定金 < MAX(select 累交定金 from 交款记录 where 交款记录.销售编号= '" & f & "' group by 累交定金"
)