|
我的设想是这样的,在客户名称框中输入相关的客户名称,单击"客户查询"按键,查询"打印查询"表,把符合条件的"销售品种"中的产品的数量、总价显示在窗体中
Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
Dim i As Integer
Dim STemp As String
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
STemp = "Select * Form 打印查询"
Rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockBatchOptimistic
Num = 0
For i = 1 To Rs.RecordCount
If Rs("客户名称") = Me![客户名称] Then
If Me![销售品种] = Me![内酯豆腐] Then
Me![数量] = Me![数量]
Me![总价] = Me![总价]
If Me![销售品种] = Me![日本豆腐] Then
Me![数量] = Me![数量]
Me![总价] = Me![总价]
If Me![销售品种] = Me![板豆腐] Then
Me![数量] = Me![数量]
Me![总价] = Me![总价]
End If
Rs.movNetxt
End If
Rs.movNetxt
End If
Rs.movNetxt
Nexit i
Exit_Command14_Click:
Exit Sub
Er_Command_Click:
MsgBox Err.Description
Rsume Exit_Command14_Click
End Sub |
|