I live in a non-English speaking country and my workplace has technicions that speak English and managers that speak the local language. So when I program in Access I always have to fix the reports so the managers will understand. Access reports, even though they appear like FORMS in DESIGN view, they are quite different.
Even you English-folks out there could have good reason to use codes in Access reports. One example:
You use a form with a check box whose field is "Breakable". That field in the underlying table is a yes/no field. If you use the report wizard to make a report out of that form and you want to group on the "Breakable", so the report is divided into Breakable YES and Breakable NO. Wouldn't it be better to have "Fragile" and "NonFragile" appear in your report? How do you do that? By code. Where does the code need to be? Do a right-click on the "DETAIL" section of the report>click "BUILD">click "CODE". Take my advise: DO NOT CODE ANYWHERE ELSE when fiddling with reports.
There is something unusual about coding reports: You can not mention fields in the code that do not have a textbox or check box in the DETAILS section. Don't ask me why. So if you need a field, place a text box bound to that field in the DETAILS secttion and make it small and invisible. Now your code will work.
Now back to our example ("Breakable Yes"="Fragile"):
Put an unbound textbox in the DETAIL section and call it txtFragile
Code like this:
if [Breakable]=true then
txtFragile="FRAGILE"
else
txtFragile="NON-FRAGILE"
end if
Now make the checkbox invisible. Do not delete it or your code will not work!
Of course, fiddle with the unbound textbox to place it properly on the report.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.