Reports

  • Thread starter Thread starter PAOLO
  • Start date Start date
P

PAOLO

I am creating a form with lots of Yes/No values.

I want the users to go into this form and select yes and no to all of these
fields. Then when they print the report I want the report to print standard
sentences:

for example the field would say:

Does the store count the float at the end of the day?

If the user ticks the box (as yes) I want a sentence on the report that
states:

The store counts the float at the end of each day

If the user doens't tick the box, the statement on the report should say:

The store does not count the float at the end of each day.

Where do I type the If sentence in the report?
In a form I normally pick and event and type all the vba statements that I
have no idea how to do this in a report....

Thank you

Paolo
 
One way to do this would be to base the report on a query (not on the
table). The query would contain the IF tests that you mention. The SQL
of the query would look something like this:

SELECT
iif (Field1, "Field1 is TRUE", "Field1 is FALSE") AS Field1Text,
iif (Field2, "The moon is RED", "The sky is BLUE") AS Field2Text,
(etc.)
FROM
TheTable

The "iif" function has 3 parameters. If the first parameter is True,
the "iif" returns the second parameter, otherwise it returns the third.
The "AS" parts say, "name the previous value as if it was a field of
the following name: ...".

So the query will look like a version of the table that has the text
strings, instead of the yes/no values. If necessary, you could /also/
include the actual yes/no fields, if you wanted those for some putpose;
just add them to the SELECT list.

If you were really clever, you could store the text strings in another
table, so tht you could alter them without having to rewrite the query.
If you did that, the query would have to "join" the two tables. Perhaps
that is an exrcise for afterwards!

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top