可在代码中加入 if isnull(dlookup("ProducerCode",表名,"ProducerCode=" & 刚才的录入 &)) then 不追加 else 追加作者: sunny-xie 时间: 2008-3-20 10:49
[:41] 期待上传例子作者: huangqinyong 时间: 2008-3-20 11:00 http://www.office-cn.net/vvb/thread-59958-1-1.html
你这个示例中所需的代码我直接故你搞好了:
INSERT INTO 字段表 ( ProducerCode )
SELECT 产品.ProducerCode
FROM 产品 LEFT JOIN 字段表 ON 产品.ProducerCode = 字段表.ProducerCode
GROUP BY 产品.ProducerCode, 字段表.ProducerCode
HAVING (((字段表.ProducerCode) Is Null))
ORDER BY 产品.ProducerCode;作者: sunny-xie 时间: 2008-3-20 11:47
在保存记录按钮的点击事件里这样写?
Private Sub 保_存_Click()
On Error GoTo Err_保_存_Click
Dim sql As String
sql = "INSERT INTO 字段表 ( ProducerCode ) SELECT 产品.ProducerCodeFROM 产品 LEFT JOIN 字段表 ON 产品.ProducerCode = 字段表.ProducerCode GROUP BY 产品.ProducerCode, 字段表.ProducerCode HAVING (((字段表.ProducerCode) Is Null)) ORDER BY 产品.ProducerCode;"