|
我是2003版的打不开你的库
给你做个例子吧- Private Sub Command2_Click()
- Dim rs As New ADODB.Recordset
- Dim strSQL As String
- Dim i As Integer, j As Integer, k As Integer, P As Integer
- Dim str As String
- rs.Open "A", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
- Do While Not rs.EOF
- str = rs.Fields(0)
- P = InStr(str, "-")
- j = Left(str, P - 1)
- k = Mid(str, P + 1)
- For i = j To k
- strSQL = _
- "INSERT INTO B ( [S/N], 型号, Workorder, McCODE, 计划日期 )VALUES('" & i _
- & "','" & rs.Fields(1) & "','" & rs.Fields(2) & "','" & _
- rs.Fields(3) & "','" & Format(Date, "yyyy") & "-" & rs.Fields(4) & _
- "')"
- CurrentDb.Execute strSQL
- Next
- rs.MoveNext
- Loop
- Me.B_子窗体.Requery
- rs.Close
- Set rs = Nothing
- End Sub
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|