简体   繁体   English

在MS Access / VBA中打开之前填充表格

[英]Populate a form before opening in MS Access/VBA

I have a form in MS Access 2013. I'd like to print most, but not all, of the values on the parent form (excluding some text fields, buttons, etc). 我在MS Access 2013中有一个表单。我想在父表单上打印大部分(但不是全部)值(某些文本字段,按钮等除外)。 My initial approach is to create a child form with only the fields I'd like to be printed. 我最初的方法是创建仅包含我要打印的字段的子窗体。 Upon clicking on a "print" button, I'd like to populate the fields on the child form with the corresponding data from the parent form, open the form, and print it. 单击“打印”按钮后,我想用来自父表单的相应数据填充子表单上的字段,打开表单并进行打印。

  1. is this the correct approach to achieve what i'm trying to do? 这是实现我想要做的正确方法吗?
  2. if so, can i create an instance of the form object, populate it, and open it (much as i would do in Java, which is the base of my coding knowledge). 如果是这样,我是否可以创建表单对象的实例,填充并打开它(就像我在Java中所做的那样,这是我编码知识的基础)。 what would that code look like? 该代码是什么样的?

Thanks, 谢谢,

jeff 杰夫

In Access controls (textboxes, lables, checkboxes, etc) have a property called "display when". 在Access控件(文本框,标签,复选框等)中,有一个名为“ display when”的属性。 You can set controls to be displayed "Screen Only" so they won't appear when you click print. 您可以将控件设置为“仅屏幕”显示,以便在单击“打印”时它们不会出现。

While we could do with some more of an explanation it sounds like you want to print information to do with a record you are looking at. 虽然我们可以做更多的解释,但这听起来像是您要打印信息以与正在查看的记录有关。 You could make a form that looks how you want it to print, then on click of a button from your main form you can open the record you are viewing in the print form. 您可以制作一个看起来像您希望其打印方式的表格,然后单击主表格中的一个按钮,即可打开您正在打印表格中查看的记录。 Then print from there. 然后从那里打印。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM