访问报告“Can Grow”属性需要影响相邻控件

mis*_*ger 5 ms-access vba textbox report

我有一份报告,其中的“详细信息”部分包含一堆控件。我正在处理一个作为示例提供给我的 Word 文档,并且我在 Access 中几乎完美地重新创建了它。我现在需要的是一种处理文本框溢出的方法。我启用了“Can Grow”,但真正的问题是:

我有一张假桌子。多个文本框的排列方式在子窗体中不起作用。某些细胞具有红色、绿色或黄色背景,而其他细胞则只是纯白色。当其中一个文本字段溢出并“增长”时,同一行中的其他文本框保持与以前相同的大小,并且看起来非常非常奇怪(703 缇与 300 缇)。我真的很希望它能够像 word/excel 中的表格一样工作,并且整行会立即增长(全部 = 703 缇),但看到它实际上并不是一个“行”,我只是想要将这些文本框的高度相互关联的方法。

这样的事情可能吗?如果我需要澄清任何事情,请告诉我,我希望我已经提供了足够的信息。

小智 7

在报表的设计视图中,选择详细信息部分中的所有文本框控件以及页眉部分中的所有标签。右键单击文本框控件之一并选择Layout -> Tabular。控件和标签现在应该相互对齐。

您尚未设置正在使用的 Access 版本,但这适用于 Access 2007。

  • 我刚刚遇到了同样的问题。我想补充一点,我通过向表格布局添加网格线,然后将某些表格单元格中的填充更改为 0" 解决了间距问题。我更改了网格线颜色,现在一切看起来都像以前一样之前,除了整行随着内容增长。 (2认同)

mis*_*ger 2

好的,我们开始吧。所以我有一个假表格,我需要它在每个文本框周围都有表格边框,当一个文本框比行中的其他文本框高时,边框看起来完全错误。因此,我们要做的就是在运行时在报表上进行绘制,这可以在任何视图中完成,包括打印预览。此代码必须放置在 Print 事件中

'step one. find out which box in the row has the greatest height value. 
'You can come across this information however you want. 
'It will likely depend on what data goes in the boxes.
'For the sake of the answer length we will skip that actual code

'step two. Take measurements and store them in variables.
'You will need a start point, and an end point in standard (x1,y1),(x2,y2) form.
Dim t As Integer 'top
Dim l As Integer 'left
Dim b As Integer 'bottom

'step three. Use these measurements and draw your lines.
'Try to use looping if your naming and report layout work will allow it.
Me.Line (l, t)-(l, b), RGB(0, 0, 0)
'       (x1,y1)(x2,y2),pick a color
'We just drew a line straight down the length of the control
'If you plan ahead, and place a line on the report permanently on top of the first row
'and below every row, you will only need to draw vertical lines.
'The lines below each row will be pushed down by the tallest control
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助。我以前根本不知道有这种东西存在。以下是有关它的 MSDN 信息:http://msdn.microsoft.com/en-us/library/aa221362%28v=office.11 ​​%29.aspx