VBA中的查询构建需要帮助 [英] Help Required on Query Building in VBA

查看:81
本文介绍了VBA中的查询构建需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我希望有人可以帮我解决访问2003中的以下问题:


我有一张包含以下内容的表格字段:


emp_id,emp_name,repdate,actions,duration,lob,categ ory,ltstatus


emp_id不是唯一的,似乎有不是这个表的主键。


actions字段存储在ltstatus下记录的所有操作的计数,它们的持续时间记录在duration字段下。


每个吊球和吊杆可以有多个动作。类别。


我需要的是以下内容:


所有独特的操作都需要从表格中排除,然后是每个独特的日期( repdate),emp_id,lob&类别组合,我需要持续时间和行动总和的总和(行动的数量目前是8,因此它使8 * 2 = 16个字段记录每个动作的持续时间和行动总和)


我目前能够通过循环记录来完成任务但是它需要非常长的时间(当然是由于循环)..


我正在寻找的是一个解决方案(可能是一个查询?),它可以更快地完成...


请帮忙。


谢谢。

Hello,

I hope someone can help me in resolving the following in access 2003:

I have a table with the following fields:

emp_id,emp_name,repdate,actions,duration,lob,categ ory,ltstatus

emp_id is not unique and there appears to be no primary key for this table.

the actions field stores the count of all actions recorded under ltstatus and their duration is logged under duration field.

there can be multiple actions for each lob & category.

What i need is the following:

All unique actions need to be sidelined from the table and then for each unique date (repdate), emp_id, lob & category combination, i need the sum of duration and sum of action (the number of actions is currently 8 and hence it makes 8*2=16 fields to record the sum of duration and sum of action for each action)

I am currently able to accomplish the task by looping through the records but it is taking a very very very long time (due to the loops of course)..

What I am looking for is a solution (a query perhaps?) which can do it faster...

Pls help.

Thanks.

推荐答案

为此你可以跨表查询使用。

要获得16列,你需要创建一个查询:
For this you can use across table query.
For getting the 16 columns you need to create a query like:
展开 | 选择 | Wrap | 行号


抱歉,但这不起作用....


请建议备用修复...
Sorry, but this is not working....

Please suggest alternate fix...


当前代码如下:

The current code is as follows:

展开 | 选择 | Wrap | 行号


这篇关于VBA中的查询构建需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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