Dim i As Long
For i = 打印凭证开始号.Value To 打印凭证结束号.Value
Dim vieA As ADOX.View
Dim cat As New ADOX.Catalog
Dim cmdA As ADODB.Command
Set cat.ActiveConnection = CurrentProject.Connection
Set cmdA = cat.Procedures("计件工资单查询").Command
cmdA.CommandText = "select * from 计件工资单 where (field1='" & trim(str(i))& "')" '如果是字符用这行
cmdA.CommandText = "select * from 计件工资单 where (field1= " & trim(str(i))& ")" '如果是数字用这行
Set cat.Procedures("计件工资单查询").Command = cmdA
DoCmd.OpenReport "计件工资单", acViewNormal
Next
End Sub
[此贴子已经被作者于2002-10-26 22:13:05编辑过]
|