|
wang1950317 发表于 2012-12-26 17:01
Henry D. Sy 老师,附件已在上面啦。请指点。 - Private Sub Command0_Click()
- Dim sSQL As String
- Dim strSQL As String
- Dim rs As New ADODB.Recordset
- Dim rst As New ADODB.Recordset
- Dim strbh As String
- Dim strfldName As String
- Dim strdd As String
- Dim strxm As String
- CurrentDb.Execute "delete from A"
- sSQL = "SELECT DISTINCT Left([编号],Len([编号])-1), 地点, 结果.项目 FROM 结果;"
- rs.Open sSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
- Do While Not rs.EOF
- strfldName = ""
- strbh = rs.Fields(0)
- strdd = rs.Fields(1)
- strxm = rs.Fields(2)
- sSQL = "SELECT 地点, 项目, 结果 FROM 结果 WHERE Left([编号],Len([编号])-1)='" & strbh & "'"
- rst.Open sSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
- Do While Not rst.EOF
- strfldName = strfldName & "'" & rst.Fields("结果") & "',"
- rst.MoveNext
- Loop
- strSQL = "insert into a (地点,项目,结果1,结果2,结果3,编号) values('" & strdd & "','" & strxm & "'," & strfldName & "'" & strbh & "')"
- CurrentDb.Execute strSQL
- rst.Close
- rs.MoveNext
- Loop
- Me.AA.Requery
- rs.Close
- Set rs = Nothing
- Set rst = Nothing
- End Sub
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|