Field Appearance Based On Another Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 2002

In my form how do I get a field not to appear if another field has a empty entry. Meaning: if field2 is empty field1 will not appear on the form.

I use queries to load and print forms

Steve
 
Sorry I meant Report vice Form

Steve

Use the Format event of the report section that the control is in.
Here is code to be used in the Detail Format event:
[Field1].Visible = Not IsNull([Field2])
 
I dont understand what you mean. I went into the report in access and in the properties of the field i went to event and it didnt have anything listed. What am i doing wrong?

fredg said:
Sorry I meant Report vice Form

Steve

:

Access 2002

In my form how do I get a field not to appear if another field has a empty entry. Meaning: if field2 is empty field1 will not appear on the form.

I use queries to load and print forms

Steve

Use the Format event of the report section that the control is in.
Here is code to be used in the Detail Format event:
[Field1].Visible = Not IsNull([Field2])

Cindy,

Regarding > the properties of the field i went to event<

You didn't read my reply correctly.

I wrote >> Use the Format event of the REPORT SECTION that the control
is in.<<

It's not the control's Format event (Controls don't have format
events) but the Report section's Format event.

In a report, to make one control not visible if another control is
Null, in Report Design View right-click in an empty part of the Detail
Section (if the control is in the Detail Section, otherwise whatever
section the control is in), and display that section's property sheet.
Click on the Events tab.
Report sections have a Format, Print, and Retreat event.
On the Format event line, write [Event Procedure].
Then click on the button with the 3 dots that will appear on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code. Type:

[Field1].Visible = Not IsNull([Field2])

between those 2 lines.
Change [Field1] and [Field2] to the actual field names you are using.

When done, close the code window and run the report.
 
Back
Top