问题:表A 和 表B 有若干个字段,我想从表A里取字段A,B,C,从表B里取字段E,F,G。
有劳各位帮解决一下,谢谢!!!
有问题的代码如下(报错:至少一个参数没有被指定值):
Private Sub cmd查询_Click()
On Error GoTo 0
Dim STemp As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Me.Form.Refresh
STemp = "SELECT [tbl入库].* FROM [tbl入库] WHERE 入库ID = '" & Me.入库号 & "'"
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
With rs
Me.卸车单号 = ![卸车单号]
Me.日期 = ![日期]
Me.客户名称 = ![公司名称]
Me.工作号 = ![工作号]
Me.入库车牌 = ![车牌号码]
Me.入库柜号 = ![入库柜号]
Me.入库操作 = ![操作人]
End With
rs.Close
STemp = "SELECT [tbl卸货派工].* FROM [tbl卸货派工] WHERE 入库号 = '" & Me.入库号 & "'"
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
With rs
Me.预到数 = ![预到数]
Me.实到数 = ![实到数]
Me.主班 = ![主班]
Me.副班 = ![副班]
Me.下单时间 = ![下单时间]
Me.完工时间 = ![完工时间]
End With
rs.Close
Set rs = Nothing
End Sub
Private Sub cmd查询_Click()
....
STemp = "SELECT [tbl入库].* FROM [tbl入库] WHERE 入库ID =" & Nz(Me.入库号, 0)
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
With rs
Me.卸车单号 = ![卸车单号]
....
End With
End If
rs.Close
STemp = "SELECT [tbl卸货派工].* FROM [tbl卸货派工] WHERE 入库ID =" & Nz(Me.入库号, 0)
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
With rs
Me.预到数 = ![预到数]
.....
End With
End If
....
End Sub