Conditional Label or Text Box

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

Guest

Valued Friends,

I have a report of researchers. Some researchers have Co-Authors whose names
appear in individual fields (so I can stack one co-author per line in the
report), co-author#1, co-author#2, co-author#3, etc.

I wish to have a Column Heading ("Co-Authors") over the Co-Author names. If
the field [co-author#1] is empty, I don't want the "Co-Author" column heading
appearing over empty space.

Any suggestions as to how I might accomplish this?
 
If the label is in the Detail section, you can hide it for that particular
record like this:
1. Right-click the label and choose Change To | Text Box.
2. Set the Control Source of the label to:
=IIf([co-author#1] Is Null, Null, "Co-Author")

That will not work though if the label is in a page header or group header,
because it looks only at the first record and the might be others on the
page that do have a co-author.

Ultimately, this is not the right way to design a database. If a paper can
have multiple authors, you have a one-to-many relation between papers and
authors. It is also true that authors write more than one paper, so there is
actually a many-to-many relation between papers and authors. That means you
need tables like this:
- Paper: one record for each research paper, with PaperID primary key.
- Author: one record for each author, with AuthorID primary key.
- PaperAuthor table, with fields:
PaperID foreign key to Paper.PaperID
AuthorID foreign key to Author.AuthorID
Priority Number (the order of listing of the authors for a
paper.)
 
Back
Top