B
buzz
Well, I was looking all through this forum and couldn't find anything to
really work. Seemed there were a lot of similar questions but the
resolutions didn't help mine.
I have a form that users set values on and a query is based on those values.
The one problem I am dealing with is that the users have an option of a
hidden field showing to them to enter things on if needed; so they are either
entering an Index_Date value or a number sequence that is part of this ICN
field. My problem is with the IIf statement for the Index_Date field because
either I base it on the form's field value or I just try and display all
records (essentially using the IIf statement to figure out if it needs to
filter or not) and I can't make this work right.
The criteria for this Index_Date field in the query is:
Like
IIf([Forms]![frmBucketNumber-index]![CalendarDate]<>'',[Forms]![frmBucketNumber-index]![CalendarDate],"*")
The prior works perfect if the field has a value; but I need it to also show
the record if there is no value in the field. An "Is Null" criteria for this
field in the query will show me the values and even changing this query field
to have a criteria of:
Like "*" Or Is Null
does exactly what I want. But I can't get this to work right in an IIf
statement. And any alterations I've been doing is giving me no record
results or that too complex query error (which I wonder if it may be due to
how I'm running statements in the other fields for the query).
Below is my entire SQL if you need it (have fun with that one):
SELECT IMAGING_BATCH_T.BUCKET_NBR, IMAGING_CONTRACT_DIVISION_T.CONTRACT,
IMAGING_FOLDER_T.INDEX_DT, UCase$([INDEX_OPER]) AS Expr1,
IMAGING_BATCH_T.PROCESS_NM, IMAGING_FOLDER_T.ICN, IMAGING_FOLDER_T.BATCH_NM,
IMAGING_CONTRACT_DIVISION_T.DIVISION, IMAGING_FOLDER_T.REJECT_REASON,
IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM
FROM (IMAGING_BATCH_T INNER JOIN IMAGING_FOLDER_T ON
IMAGING_BATCH_T.BATCH_NM = IMAGING_FOLDER_T.BATCH_NM) INNER JOIN
IMAGING_CONTRACT_DIVISION_T ON IMAGING_BATCH_T.PROCESS_NM =
IMAGING_CONTRACT_DIVISION_T.PROCESS_NM
GROUP BY IMAGING_BATCH_T.BUCKET_NBR, IMAGING_CONTRACT_DIVISION_T.CONTRACT,
IMAGING_FOLDER_T.INDEX_DT, UCase$([INDEX_OPER]), IMAGING_BATCH_T.PROCESS_NM,
IMAGING_FOLDER_T.ICN, IMAGING_FOLDER_T.BATCH_NM,
IMAGING_CONTRACT_DIVISION_T.DIVISION, IMAGING_FOLDER_T.REJECT_REASON,
IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM
HAVING
(((IMAGING_BATCH_T.BUCKET_NBR)=[Forms]![frmBucketNumber-index]![BucketNumber])
AND
((IMAGING_CONTRACT_DIVISION_T.CONTRACT)=[Forms]![frmBucketNumber-index]![Contract])
AND ((IMAGING_FOLDER_T.INDEX_DT) Like
IIf([Forms]![frmBucketNumber-index]![CalendarDate]<>'',[Forms]![frmBucketNumber-index]![CalendarDate],"*"))
AND ((IMAGING_FOLDER_T.ICN) Like
IIf([Forms]![frmBucketNumber-index]![JulianDate]<>"",IIf([Forms]![frmBucketNumber-index]![Division]="Medicare","??"
& [Forms]![frmBucketNumber-index]![JulianDate] &
"??????",[Forms]![frmBucketNumber-index]![JulianDate] & "*"),"*")) AND
((IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM)="Madison"));
really work. Seemed there were a lot of similar questions but the
resolutions didn't help mine.
I have a form that users set values on and a query is based on those values.
The one problem I am dealing with is that the users have an option of a
hidden field showing to them to enter things on if needed; so they are either
entering an Index_Date value or a number sequence that is part of this ICN
field. My problem is with the IIf statement for the Index_Date field because
either I base it on the form's field value or I just try and display all
records (essentially using the IIf statement to figure out if it needs to
filter or not) and I can't make this work right.
The criteria for this Index_Date field in the query is:
Like
IIf([Forms]![frmBucketNumber-index]![CalendarDate]<>'',[Forms]![frmBucketNumber-index]![CalendarDate],"*")
The prior works perfect if the field has a value; but I need it to also show
the record if there is no value in the field. An "Is Null" criteria for this
field in the query will show me the values and even changing this query field
to have a criteria of:
Like "*" Or Is Null
does exactly what I want. But I can't get this to work right in an IIf
statement. And any alterations I've been doing is giving me no record
results or that too complex query error (which I wonder if it may be due to
how I'm running statements in the other fields for the query).
Below is my entire SQL if you need it (have fun with that one):
SELECT IMAGING_BATCH_T.BUCKET_NBR, IMAGING_CONTRACT_DIVISION_T.CONTRACT,
IMAGING_FOLDER_T.INDEX_DT, UCase$([INDEX_OPER]) AS Expr1,
IMAGING_BATCH_T.PROCESS_NM, IMAGING_FOLDER_T.ICN, IMAGING_FOLDER_T.BATCH_NM,
IMAGING_CONTRACT_DIVISION_T.DIVISION, IMAGING_FOLDER_T.REJECT_REASON,
IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM
FROM (IMAGING_BATCH_T INNER JOIN IMAGING_FOLDER_T ON
IMAGING_BATCH_T.BATCH_NM = IMAGING_FOLDER_T.BATCH_NM) INNER JOIN
IMAGING_CONTRACT_DIVISION_T ON IMAGING_BATCH_T.PROCESS_NM =
IMAGING_CONTRACT_DIVISION_T.PROCESS_NM
GROUP BY IMAGING_BATCH_T.BUCKET_NBR, IMAGING_CONTRACT_DIVISION_T.CONTRACT,
IMAGING_FOLDER_T.INDEX_DT, UCase$([INDEX_OPER]), IMAGING_BATCH_T.PROCESS_NM,
IMAGING_FOLDER_T.ICN, IMAGING_FOLDER_T.BATCH_NM,
IMAGING_CONTRACT_DIVISION_T.DIVISION, IMAGING_FOLDER_T.REJECT_REASON,
IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM
HAVING
(((IMAGING_BATCH_T.BUCKET_NBR)=[Forms]![frmBucketNumber-index]![BucketNumber])
AND
((IMAGING_CONTRACT_DIVISION_T.CONTRACT)=[Forms]![frmBucketNumber-index]![Contract])
AND ((IMAGING_FOLDER_T.INDEX_DT) Like
IIf([Forms]![frmBucketNumber-index]![CalendarDate]<>'',[Forms]![frmBucketNumber-index]![CalendarDate],"*"))
AND ((IMAGING_FOLDER_T.ICN) Like
IIf([Forms]![frmBucketNumber-index]![JulianDate]<>"",IIf([Forms]![frmBucketNumber-index]![Division]="Medicare","??"
& [Forms]![frmBucketNumber-index]![JulianDate] &
"??????",[Forms]![frmBucketNumber-index]![JulianDate] & "*"),"*")) AND
((IMAGING_CONTRACT_DIVISION_T.SITE_LOC_NM)="Madison"));