在Microsoft Access 2013中查询 [英] Query in Microsoft Access 2013

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

问题描述

我需要在以下SQL中添加一个短语,它将执行以下操作:如果[VT]的总和达到20,则在该点插入一行或某种类型的分隔符。我基本上需要报告将VT分成1-20,21-40等组....


TRANSFORM计数([焊接日志]。活动)AS CountOfActivity

SELECT [焊接日志]。[焊工/督察],[焊接日志]。[后台打印#],[焊接日志]。[焊接#],[焊接日志] .WPS,[焊接日志] .Type ,[焊接日志]。日期,[焊接日志]。[通过或失败],[焊接日志]。评论,计数([焊接日志]。活动)AS [活动总数]

FROM [焊接日志]

WHERE((([焊接日志] .Type)=" BUTTWELD")AND((([焊接日志]。[通过或失败])=通过或([焊接日志]。[通过或失败])=失败)和(([焊接日志]。[通过或失败])=通过或([焊接日志]。[通过或失败]) =失败)))

GROUP BY [焊接日志]。[焊工/督察],[焊接日志]。[线轴#],[焊接日志]。[焊接#],[焊接日志] .WPS,[焊接日志] .NDE,[焊接日志] .Type,[焊接日志]。日期,[焊接日志]。[通过或失败],[焊接日志]。评论

PIVOT [焊接日志] .NDE;


我附上了交叉表查询和报告的副本。该报告是完美的,除了在细节部分我需要除以20的事实。每个焊工模板都会有一份单独的报告。



附加文件
(746.2 KB,24 views)

解决方案

欢迎来到字节


我建议你单独留下查询。你需要做的是在VT到达20之后插入分页符


尝试

展开 | 选择 | 换行 | 行号


我只是将它添加到我的SQL底部吗?很抱歉只是了解Access的工作原理。


我需要创建一个VBA。我花了一点时间搞清楚。谢谢!

I need to add a phrase into the following SQL that will performed the following: If the sum of [VT] reaches 20 insert a line or some type of divider at that point. I essentially need the report to divide VT into sets of 1-20, 21-40 etc....

TRANSFORM Count([Weld Log].Activity) AS CountOfActivity
SELECT [Weld Log].[Welder/Insp], [Weld Log].[Spool #], [Weld Log].[Weld #], [Weld Log].WPS, [Weld Log].Type, [Weld Log].Date, [Weld Log].[Pass or Fail], [Weld Log].Comment, Count([Weld Log].Activity) AS [Total Of Activity]
FROM [Weld Log]
WHERE ((([Weld Log].Type)="BUTTWELD") AND ((([Weld Log].[Pass or Fail])="PASS" Or ([Weld Log].[Pass or Fail])="Fail") And (([Weld Log].[Pass or Fail])="Pass" Or ([Weld Log].[Pass or Fail])="Fail")))
GROUP BY [Weld Log].[Welder/Insp], [Weld Log].[Spool #], [Weld Log].[Weld #], [Weld Log].WPS, [Weld Log].NDE, [Weld Log].Type, [Weld Log].Date, [Weld Log].[Pass or Fail], [Weld Log].Comment
PIVOT [Weld Log].NDE;

I have attached a copy of the crosstab Query and Report. The report is perfect except for the fact that under the detail portion I need to divide at sum of 20. There will be a separate report for each welder stencil.

Attached Files
(746.2 KB, 24 views)

解决方案

Welcome to Bytes

I suggest you leave your query alone. What you need to do is insert a page break after VT gets to 20

Try

Expand|Select|Wrap|Line Numbers


Do I just add this to the bottom of my SQL? Sorry just learning how Access works.


I need to create a VBA. Just took me a moment to figure it out. Thanks!


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

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