EASIEST question of the day!!!!!!

razorkat99

Still figurin' it out
Local time
Yesterday, 22:06
Joined
Oct 22, 2007
Messages
35
TOTAL Brain Freeze here!

In my report I need to pull ONLY those records where the selection on the data entry form equals "yes". What's the expression I need? I've tried tons of things I could think of and am losing my mind!
 
in your qry its gonna be either 0 or -1 (minus one)
 
Hmmmm.... sorry, not much help. I'm not extracting the data into a query and then pulling it into a report, I'm setting the criteria up for a specific field within the report that's pulled from a form. I need to know the statement I need to use, i.e. =IIf(.....

Does this make sense?
 
not really - but here we go

on your report (design) got to details - build event

you get code window

then the usual codeing - however you might have to use ! instead of . like below

If Me!Tvalue = -1 Then
Me!invtype = " CREDIT"

also some the auto complete fuctiosn when you are in this section aren't there so you might have to type them in full (I mean me.xxxxx - it will not put the xxxx in automactically
 
side note - i have always been told (perhaps wrongly) that reports shouldbe on qry's - but hell..who know if it works
 
In the criteria section of the field in the underlying query it's just Yes or True (without quotes, assuming it's a boolean field)
 
Let me just clarify..... i CAN'T set the criteria up in my form in the Expression Builder to pull just those records whose answer is "Yes", i HAVE to use a query? I thought I would be able to use a SELECT expression, but haven't been successful.

My field is: Has_Service_Been_Less_Than_1_Year?
Options: Yes or No
 
THis goes back to my thought - that reports should be based on qry ( mostly )
if you base them on a table - you run into this sort of problem

your qry can contain all of the table fields and then you have this ability to run of those that are either x or y or if you want to get creative with detail properties

if you go down this route it is not a major change
first make qry then add all the fields in individualy (not on block)
now make a copy of your report (save as or copy) now change the source of the report to your new qry
 
Just an FYI - as you do NOT need a separate query or report to do this. You can open a generic report and filter depending on your needs with:

DoCmd.OpenReport "YourReportNameHere", acViewPreview,, "[YourBooleanFieldNameHere]=True"
 

Users who are viewing this thread

Back
Top Bottom