|
楼主 |
发表于 2023-5-15 15:27
|
显示全部楼层
我看了一下,好像没有,这里时全部的代码
Private Sub CommandButton4_Click()
Dim sqlFd1 As String
Dim sqlFd2 As String
Dim rsFd As New ADODB.Recordset
Dim i As Integer
sqlFd1 = "select * from 入库明细表 where (产品编码 = '" & Replace(TextProIDFd, "'", "''") & "')"
sqlFd2 = "select * from (" & sqlFd1 & ") where (入库登记编码 = '" & Replace(TextRgNoFd, "'", "''") & "')"
Set rsFd = con.Execute(sqlFd2)
Sheet3.Activate
Sheet3.Cells.Clear
For i = 0 To rsFd.Fields.Count - 1
If rsFd.BOF And rsFd.EOF Then
MsgBox "没有找到相关记录"
Else
Sheet3.Cells(1, i + 1) = rsFd.Fields(i).Name
End If
Next
Sheet3.Range("A2").CopyFromRecordset rsFd
End Sub
|
|