Access Reports changing values at run time

Z

Zleviticus

Ok I am trying to write a report from an access database
the report MUSt run from access so crystal or VB report
is out of the question. I want to be able to look at a
particluar value form a query and change what is
displayed based on this value... for exampe if I could I
would use an if statement like

If (thisqueryvalue) = "N" then
(some_text_box_on_report.value) = "None Selected"
else (some_text_box_on_report.value) =(thisqueryvalue)

any ideas on how to do this?
 
J

John Spencer (MVP)

Fairly straightforward.

Add a textbox to the report and don't bind it to any field - leave the control
source BLANK.

Add a second textbox to the report and bind it to the field you want to test.
Set its visible property to "No"

Then in the section that contains the controls add your code



If Me.BoundBox = "N" then
Me.UnboundBox = "None Selected"
Else
Me.UnboundBox = Me.BoundBox
End If

Or modify your source query with an IIF statement

IIF (FieldName = "N", "None Selected",FieldName)
 

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

Top