Skip to content

The day I finally got the expression builder to actually build a useful expression…

August 25, 2014

I know, a little play on words, but seriously, have you ever tried to use the expression builder found in MS Access?  I have tried it a *few times over the years, without much success.

The other day, my access customer asked me if I could place a message in a report, but only for a specific one.  Ok, sounded reasonable.  Find the form, find the event called on a certain button click, in the event code, find the referenced report, open the report, find the control in the form that is responsible for showing the value asked for, then……figure out how to *ask the question.

The question was this “how do I show this message when ever that kit number shows up in a report?

What I ended up doing was adding a text box to the report in the detail section and building an expression that actually worked.  Once the textbox was in place, I opened the properties to it and clicked the datasource – then the …., which brought up the expression builder.

access_report

I actually placed it in the kit_Number footer.  The expression looked like this:

=IIf([Kit_Number]=”ES112″,”a message about this kit….”)

Seems trivial in hindsight, but I have tried to build expressions before with this tool and have failed over and over. 

I guess it took a simple, logic need

If(test,”true”,”false”) is a pretty basic expression, but then again, basic is in the eye of the beholder.

The result is on this report, when that kit number shows up, the report looks like this:

 

Advertisements

From → MS Access

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: