|
5#
楼主 |
发表于 2011-7-1 09:49:40
|
只看该作者
todaynew 发表于 2011-6-30 16:52
Sub insertTb(frm As Form)
Dim ssql As String
Dim strwh As String
唉,依葫芦画瓢也不会,帮我再改改吧
Sub insertTb(frm As Form)
Dim ssql As String
Dim strwh As String
ssql = frm.RecordSource
strwh = frm.Filter
if Dcount("*","结算表",strwh)=0 then
ssql = Trim(ssql)
If Right(ssql, 1) = ";" Then
ssql = Left(ssql, Len(ssql) - 1)
End If
ssql = "select 编号,名称,数量,单价 from (" & ssql & ") where " & strwh
ssql = "INSERT INTO 结算表 ( 编号, 名称, 数量, 单价 ) " & ssql
CurrentDb.Execute ssql
else ’已结算=true ,不更新
esle'如果编号+名称重复,且已结算=false,则更新【数量】和【单价】
ssql = Trim(ssql)
If Right(ssql, 1) = ";" Then
ssql = Left(ssql, Len(ssql) - 1)
End If
CurrentDb.Execute ssql
end if
End Sub |
|