|
我没看你的库,你看下以下:
如果没有subform:
Private Sub cmdSearch_Click()
On Error Goto cmdSearch_Click Err
Dim Stemp As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Me.Form.Refresh
Stemp = "SELECT [tblMaterial].* FROM [tblMaterial] WHERE OrderNo LIKE '" & Me.OrderNo & "' "
rs.Open Stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
With rs
Me.Material = ![Material]
Me.Qty = ![Qty]
End With
rs.Close
cmdSearch_Click Err: Exit Sub
End Sub
如果有subform,就加一句:
docmd.runsql "insert into tblTemp select [tblMaterial].[Material], [tblMaterial].[Qty] from [tblMaterial] where OrderNo LIKE '" & Me.OrderNo & "' "
这个……避免系统报警,前面加个setwarnings false,完了后面加个serwarnings true,不然蛋会疼。
|
|