北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
On Error GoTo ErrorHandler
Dim strsql As String
Dim cnn As Object 'ADODB.Connection
Dim rst As Object 'ADODB.Recordset
Dim rstTmp As Object 'DAO.Recordset
ApplyTheme Me
CurrentDb.Execute "DELETE FROM [TMP_tblAppraisal]"
If IsNull(Me.OpenArgs) Then
Me.DataEntry = True
End If
If Me.DataEntry Then
Me.sfrDetail.Requery
Exit Sub
End If
Me.btnSave.Enabled = Me.AllowEdits
Set cnn = CurrentProject.Connection
strsql = "SELECT * FROM [tblContract] WHERE [xsID]=" & Nz(Me.OpenArgs, 0)
Set rst = OpenADORecordset(strsql, , cnn)
Me![xsID] = rst![xsID]
Me![salesCode] = rst![salesCode]
Me![CustomerID] = rst![CustomerID]
Me![Customer] = rst![Customer]
Me![State] = rst![State]
rst.Close
strsql = "SELECT * FROM [tblAppraisal] WHERE [xsID]=" & Nz(Me![xsID], 0)
Set rst = OpenADORecordset(strsql, , cnn)
Set rstTmp = CurrentDb.OpenRecordset("TMP_tblAppraisal")
Do Until rst.EOF
rstTmp.AddNew
rstTmp![AppraisalID] = rst![AppraisalID]
rstTmp![xsID] = rst![xsID]
rstTmp![AppraisalCode] = rst![AppraisalCode]
rstTmp.Update
rst.MoveNext
Loop
rst.Close
rstTmp.Close
Me.sfrDetail.Requery
strsql = "SELECT * FROM [tblContractItem] WHERE [xsID]=" & Nz(Me![xsID], 0)
Set rst = OpenADORecordset(strsql, , cnn)
Set rstTmp = CurrentDb.OpenRecordset("TMP_tblContractItem")
Do Until rst.EOF
rstTmp.AddNew
rstTmp![xsmxID] = rst![xsmxID]
rstTmp![xsID] = rst![xsID]
rstTmp![productID] = rst![productID]
rstTmp.Update
rst.MoveNext
Loop
rst.Close
rstTmp.Close
Me.sfrEditDetail.Requery
ExitHere:
Set rst = Nothing
Set cnn = Nothing
Set rstTmp = Nothing
Exit Sub
运行窗体发现子窗体sfreditDetail中记录集并不仅仅是当前XSid的记录,还包括其他订单的明细记录。代码错在哪里呢?
请各位帮我看看问题出在哪里?谢谢!