试试:(仅限于你提供的格式,"//发票下有三行数据)
Function GetData()
Dim rs As DAO.Recordset, rs1 As DAO.Recordset, I As Integer, INV As String
Set rs = CurrentDb.OpenRecordset("Select * from 结构表1")
Set rs1 = CurrentDb.OpenRecordset("Select * from 结构全称")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If InStr(1, rs.Fields(0), "//发票", vbBinaryCompare) > 0 Then
INV = rs.Fields(0)
rs.MoveNext
rs1.AddNew
rs1.Fields(0) = INV
rs1.Fields(1) = rs.Fields(0)
rs1.Fields(2) = rs.Fields(1)
rs1.Fields(3) = rs.Fields(2)
rs.MoveNext
rs1.Fields(4) = rs.Fields(0)
rs1.Fields(5) = rs.Fields(1)
rs1.Fields(6) = rs.Fields(2)
rs.MoveNext
rs1.Fields(7) = rs.Fields(0)
rs1.Fields(8) = rs.Fields(1)
'rs1.Fields(9) = rs.Fields(2)
rs1.Update
End If
rs.MoveNext
Loop
End If
Set rs = Nothing
Set rs1 = Nothing
End Function
[此贴子已经被作者于2006-8-9 13:17:11编辑过]
|