Thursday, March 22, 2012

Alert User of Invalid Parameter Entry

Does anyone know if there is a way to alert the user that the parameter
value is invalid prior to the report rendering?
One of the parameters is an account number '########'. The user is
accustomed to seeing it as '###-####-#' and may enter it in that
format. I've already put the usual '(With no dashes)' next to the
prompt. However, if they do put dashes, (or some other invalid format),
the report runs as normal and spits out a blank report.
I would like the user to be aware of invalid parameter entries, similar
to a web app, or windows form.
TIA.On Dec 21, 11:06 am, Michael <Mich...@.discussions.microsoft.com>
wrote:
> Does anyone know if there is a way to alert the user that the parameter
> value is invalid prior to the report rendering?
> One of the parameters is an account number '########'. The user is
> accustomed to seeing it as '###-####-#' and may enter it in that
> format. I've already put the usual '(With no dashes)' next to the
> prompt. However, if they do put dashes, (or some other invalid format),
> the report runs as normal and spits out a blank report.
> I would like the user to be aware of invalid parameter entries, similar
> to a web app, or windows form.
> TIA.
There are a couple different things you can do. Either you can add a
textbox control to the report and set it to an expression like:
=iif(InStr(Parameters!AcctNumber.Value, "-") > 0, "Invalid Account
Number", Nothing)
-or-
You can do a replace on the Acct Number parameter entered by the user
via an expression in your dataset. An expression like this might help.
=Replace(Parameters!AcctNumber.Value, "-", "")
and you can embed them in each other to catch other stray characters
(i.e., remove all hyphens and asterisks)
=Replace(Replace(Parameters!AcctNumber.Value, "-", ""), "*", "")
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant

No comments:

Post a Comment