访问 2007 报告,隐藏字段?
Access 2007 reports, hiding fields?
我在 Access 2007 中有一份报告,其中填充了来自 SQL 服务器的数据(运行 在 vb6 应用程序上)。该报告有两个显示数据的子报告。第一个子报表有一个标签 "CHILDREN",它旁边的子报表显示 children 的名称。第二个子报表有一个标签 "PETS",它旁边的子报表显示 PetName 和 TypeOfPet。在大多数情况下,每个家庭都有宠物,但是,对于某些客户来说,没有宠物。我要做的是在没有宠物的情况下使标签 PETS 不可见,因此标签本身不在报告中。我该怎么做?这是我必须编码的东西吗?
下面link展示了如果没有数据如何隐藏标签:https://forums.techguy.org/threads/solved-access-2003-hide-field-labels-on-reports-when-value-is-null.660825/
以下是所需的步骤:
1. Delete the label from the text box.
2. Add new text box in place of the old label.
3. Format the new text box same as other label.
4. Set it's "Can Shrink" property to "Yes".
5.Bind the 'new' label to an expression that will solve to "" if the [Pet] field is blank or to the text string "Pets:" if the [Pet] field is not blank.
6. Change text box Control Source field on the Data tab of the Properties window. In it put:
iif(isnull([Pet]),"","Pets:")
This will put a zero-length string into the text box when the [Pet] field is null and the text "Pet:" when it is not null
7. If the field is blank, it could be null or a zero-length string (""), or could have any number of blank spaces in it. Rather than use "IsNull", use a combination of functions that will solve. i.e.:
Iif(trim(nz([Pet],""))="","","Pets:")
我在 Access 2007 中有一份报告,其中填充了来自 SQL 服务器的数据(运行 在 vb6 应用程序上)。该报告有两个显示数据的子报告。第一个子报表有一个标签 "CHILDREN",它旁边的子报表显示 children 的名称。第二个子报表有一个标签 "PETS",它旁边的子报表显示 PetName 和 TypeOfPet。在大多数情况下,每个家庭都有宠物,但是,对于某些客户来说,没有宠物。我要做的是在没有宠物的情况下使标签 PETS 不可见,因此标签本身不在报告中。我该怎么做?这是我必须编码的东西吗?
下面link展示了如果没有数据如何隐藏标签:https://forums.techguy.org/threads/solved-access-2003-hide-field-labels-on-reports-when-value-is-null.660825/
以下是所需的步骤:
1. Delete the label from the text box.
2. Add new text box in place of the old label.
3. Format the new text box same as other label.
4. Set it's "Can Shrink" property to "Yes".
5.Bind the 'new' label to an expression that will solve to "" if the [Pet] field is blank or to the text string "Pets:" if the [Pet] field is not blank.
6. Change text box Control Source field on the Data tab of the Properties window. In it put:
iif(isnull([Pet]),"","Pets:")
This will put a zero-length string into the text box when the [Pet] field is null and the text "Pet:" when it is not null
7. If the field is blank, it could be null or a zero-length string (""), or could have any number of blank spaces in it. Rather than use "IsNull", use a combination of functions that will solve. i.e.:
Iif(trim(nz([Pet],""))="","","Pets:")