标题: 求助:如何对表内记录在窗体内有选择进行复制 [打印本页] 作者: tuhaiyin2008 时间: 2009-1-23 04:10 标题: 求助:如何对表内记录在窗体内有选择进行复制 求助:如何对表内记录在窗体内有选择进行复制,这样可以减少输入大量重复的信息。见附件。作者: Henry D. Sy 时间: 2009-1-23 05:33
建议,
将编号12起删除掉,
然后用追加查询作者: Henry D. Sy 时间: 2009-1-23 05:59
原帖由 Henry D. Sy 于 2009-1-23 05:33 发表
建议,
将编号12起删除掉,
然后用追加查询
否则只能用记录集
Private Sub Command10_Click()
Dim strSQL As String
Dim varArray(7) As Variant
Dim rs As New ADODB.Recordset
Dim i As Integer
If IsNull(Me.Combo2) Or IsNull(Me.Combo7) Then
Exit Sub
End If
strSQL = "select a,b,c,d,f,g,h,z from 表1 where batch=" & Me.Combo2
With rs
.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
For i = 0 To .Fields.Count - 1
varArray(i) = .Fields(i)
Next
.Close
End With
strSQL = "select a,b,c,d,f,g,h,z from 表1 where batch=" & Me.Combo7
With rs
.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 0 To .Fields.Count - 1
.Fields(i) = varArray(i)
Next
.Update
.Close
End With
Set rs = Nothing
MsgBox "Copied"
End Sub