从表单上的两个组合框中选择以运行报告 [英] Select from two combo boxes on form to run report

查看:53
本文介绍了从表单上的两个组合框中选择以运行报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我一直在阅读您论坛中的一些主题并决定加入并发布我的问题。希望它不会太冗长。


我创建了一个名为paramform2的Unbound Form。此表单包含两个组合框,一个开始日期的文本框,一个结束日期的文本框和一个运行报告的命令按钮。


第一个组合框名为FindMgr 。此框的行源设置为:SELECT" All"作为MgrName FROM tblMain UNION SELECT MgrName FROM tblMain ORDER BY MgrName。 Column Count和Bound Column都设置为1. After Update事件是:


Me!FindMgr.Requery

Me!FindMgr.SetFocus


第二个组合框命名为:FindDBS。此框的行源设置为:SELECT DISTINCT strDBS FROM tblMain WHERE MGRName = Forms!ParamForm2.FindMgr ORDER BY strDBS; Column Count和Bound列都设置为1.


查询这两个框的条件是:[Forms]![ParamForm2]。[FindMgr]和[Forms]![ ParamForm2]。[FindDBS]


当我选择一个经理名称和一个员工姓名并运行报告时,我会得到该经理下列出的所有员工的报告。 />

我需要做两件事:


1.选择一个经理姓名和一个员工姓名并让报告运行对于那位经理和那位员工。


2.选择经理姓名并为该经理下的所有员工运行报告。


有没有办法做到这一点?任何帮助将不胜感激。


谢谢。

Hi All,

I have been reading some of the threads in your forum and decided to join and post my question. Hopefully it won''t be too lengthy.

I have created an Unbound Form called paramform2. This form contains two combo boxes, a text box for the start date, a text box for the end date and a command button that runs the report.

The first combo box is named FindMgr. The row source of this box is set to: SELECT"All" As MgrName FROM tblMain UNION SELECT MgrName FROM tblMain ORDER BY MgrName. Column Count and Bound Column are both set to 1. The After Update event is:

Me!FindMgr.Requery
Me!FindMgr.SetFocus

The second combo box is named: FindDBS. The row source of this box is set to: SELECT DISTINCT strDBS FROM tblMain WHERE MGRName=Forms!ParamForm2.FindMgr ORDER BY strDBS; Column Count and Bound column are both set to 1.

The criteria in the query for both boxes are: [Forms]![ParamForm2].[FindMgr] and [Forms]![ParamForm2].[FindDBS]

When I select a one manager name and one employee name and run the report, I get a report for all of the employees listed under that Manager.

There are two things I need to be able to do:

1. Select one manager name and one employee name and have the report run just for that manager and that one employee.

2. Select a manager name and have a report run for all of the employees under that manager.

Is there a way to do this? Any help would be greatly appreciated.

Thank you.

推荐答案

查询的SQL是什么样的?

DBS是员工姓名吗?看起来你的After Update事件应该重新查询FindDBS框而不是FindMgr框。
What''s the SQL for your query look like?
Is DBS = employee name? It looks like your After Update event should requery the FindDBS box rather than the FindMgr box.


Hi Chip,


感谢您的回复。


我的查询的SQL视图是:

SELECT qryMaster.MgrName,qryMaster.strSSN,qryMaster.strClaimantName,qryMaster.strProduct,qryMaster .strTypeofClaim,qryMaster.ysnApproved,qryMaster.ysnNonComp,qryMaster。[curr
Hi Chip,

Thank you for your reply.

The SQL view of my query is:

SELECT qryMaster.MgrName, qryMaster.strSSN, qryMaster.strClaimantName, qryMaster.strProduct, qryMaster.strTypeofClaim, qryMaster.ysnApproved, qryMaster.ysnNonComp, qryMaster.[curr


付费],qryMaster.dtmDecisionDate,tblDBS.DBSName

FROM(qryMaster INNER JOIN tblDBS ON qryMaster.strDBS = tblDBS.DBSName)INNER JOIN tblManagers ON(qryMaster.MgrName = tblManagers.MgrName)AND(tblDBS.cmbManager = tblManagers.MgrName)

WHERE(((qryMaster.MgrName)= [表格!![ParamForm2]。[FindMgr])AND((tblDBS.DBSName)= [Forms]![ParamForm2]。[FindDBS])AND(([tblMain]。[dtmDecisionDate])之间[forms]![ParamForm2] ![StartDate]和[Forms]![ParamForm2]![EndDate]))OR(((qryMaster.MgrName)= [Forms]![ParamForm2]。[FindMgr])AND( ([tblMain]。[dtmDecisionDate])在[forms]之间![ParamForm2]![StartDate]和[Forms]![ParamForm2]![EndDate]))OR((([Forms]![ParamForm2]。[FindMgr] )=全部));


是,DBS =员工姓名。我将更改After Update事件。


如果我能提供其他任何东西可以帮助我们找到解决方案,请告诉我。
Paid], qryMaster.dtmDecisionDate, tblDBS.DBSName
FROM (qryMaster INNER JOIN tblDBS ON qryMaster.strDBS = tblDBS.DBSName) INNER JOIN tblManagers ON (qryMaster.MgrName = tblManagers.MgrName) AND (tblDBS.cmbManager = tblManagers.MgrName)
WHERE (((qryMaster.MgrName)=[Forms]![ParamForm2].[FindMgr]) AND ((tblDBS.DBSName)=[Forms]![ParamForm2].[FindDBS]) AND (([tblMain].[dtmDecisionDate]) Between [forms]![ParamForm2]![StartDate] And [Forms]![ParamForm2]![EndDate])) OR (((qryMaster.MgrName)=[Forms]![ParamForm2].[FindMgr]) AND (([tblMain].[dtmDecisionDate]) Between [forms]![ParamForm2]![StartDate] And [Forms]![ParamForm2]![EndDate])) OR ((([Forms]![ParamForm2].[FindMgr])="All"));

Yes,DBS = employee name. I will change the After Update event.

Please let me know if there is anything else I can supply that might help us find a solution for what I need to accomplish.


这篇关于从表单上的两个组合框中选择以运行报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆