Share via

help with Control Source expression error

Anonymous
2013-12-06T22:57:22+00:00

I am having trouble with an expression in a report.  I am trying to write a conditional, where if "Status" field = "Inactive"  and Program Type field = "o" then display the Program Title and append a date onto the end of it, else just display the Program Title.

=IIf([Program Approvals]![Status]="Inactive" And [Program Approvals]![Program Type]="o",[Program Approvals]![Program Title]+CStr([ [Program Approvals]![Inactive Expires]),[Program Approvals]![Program Title])

When I run it I am getting :  " is not a valid name.  make sure that it does not include invalid characters or punctuation and that it is not too long.

That is not very helpful!  I did use the Expression Builder to write it.   Is there a way to see the SQL that is produced when one write an expression?  That could help me figure it out.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2013-12-07T01:18:12+00:00

    That was one of my choices, to run it from the query and to me, a much better way to do it.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-12-07T01:01:49+00:00

    I ended up approaching it a different way.  I don't know if it's wrong to do it this way though.  (this is my first Access project).  I made an alias column in the source query and concatenated them there.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-12-07T00:18:07+00:00

    Is it possible that Status or Program Type is empty?  By that I mean there no entry in either of the fields?  That is the most common cause of the error.  If it were me I would either write it in a query and account for NULL's or put it in VBA Editor behind the form in the On_Current event, again accounting to NULL's.

    Was this answer helpful?

    0 comments No comments