基于不同选项的明信片打印。 [英] Postcard printing based on different options.

查看:68
本文介绍了基于不同选项的明信片打印。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我是Access / VBA的新手,这让我疯了。任何帮助将不胜感激。


我必须根据以下选项创建一个可以打印明信片(4X6)的小应用程序:

客户类型

OrderNumber

LoggedDate

位置


有三个cmd按钮打印,预览和取消。


我创建了一份报告,其中包含明信片的一般外观(左上角的退货地址和中间的地址)


我基于4种不同的选项开发了四个查询。

qry_CustomerTypeOption

qry_OrderNumberOption

qryLoggedDtOption

qryLocationOption


当我将一个查询分配给报告的记录源时,它工作正常


我的问题:


我想根据所选的选项将报告的记录源更改为不同的查询。我不知道怎么做。我尝试了

展开 | 选择 | Wrap | 行号

解决方案

您可以为每个案例单独生成报告,或者你应该可以这样做:


docmd.openreport ...

案例1

报告![rptPostCard] .RecordSource =" qry_CustomerTypeOption"

case 2

Reports![rptPostCard] .RecordSource =" qry_OrderNumberOption"


我只使用表格而非报告,但它应该有效。没有时间事先尝试抱歉:(


您可以在Report_Open()过程中更改报表的RecordSource。除非新查询返回与它设计的一个。


一个更优雅的解决方案(通常 - 完全取决于你所追求的)可能是设计报告来处理所有类型,然后简单地调用相同的报告,每个选项都有不同的过滤器。


读完这篇文章后我尝试了这个:每次在Report'的On Open事件中使用case语句的同一个报告带有不同的记录源

展开 | 选择 | Wrap | 行号

Hello

I am a novice to Access/VBA and this is driving me nuts. Any help would be appreciated.

I have to create a little application which can print postcards(4"X6") based on following options:
Customer Type
OrderNumber
LoggedDate
Location

There are three cmd buttons Print, Preview and Cancel.

I created one report which has general look and feel of postcard(exmple return address on left hand upper corner and To address in the middle)

I developed four queries based on 4 different options.
qry_CustomerTypeOption
qry_OrderNumberOption
qryLoggedDtOption
qryLocationOption

When I assign one query to report''s recordsource it works fine

My problem:

I want to change the recordsource of the report to the different queries as per the options selected. I don''t know how to do it. I tried with the

Expand|Select|Wrap|Line Numbers

解决方案

You can make a separate report for each case, or you should be able to do:

docmd.openreport ...

case 1
Reports![rptPostCard].RecordSource = "qry_CustomerTypeOption"
case 2
Reports![rptPostCard].RecordSource = "qry_OrderNumberOption"

I have only used that with forms, not reports, but it should work. No time to try it beforehand sorry :(


You can change the RecordSource of a report from within the Report_Open() procedure. You may have problems unless the new query returns the same fields as the one it was designed with.

A more elegant solution (generally - depends on exactly what you''re after) might be to design the report to handle all types, then simply call the same report with a different filter for each option.


After reading this post I tried this: same report with different record source each time using case statement in Report''s On Open event like this

Expand|Select|Wrap|Line Numbers


这篇关于基于不同选项的明信片打印。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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