I have the following code in a report on open event
I'm getting all the correct data but now need to sort the report.
This is what I have so far (columns were separated just for readibility. they are actually in a continuous line:
The bolded portion really needs to say IIf(Left([PermitNo],2)="WH" And ([RetireDate] Between [txtdatestart] And [txtdateEnd]) Or [RetireDate]<[txtdatestart],"3","4"
When I build it one piece at a time, it works but when I put it together I get an error saying I have to many characters or am missing a } or |.
I think a better method may be to put the input prompt in the query but I wasn't sure if I could do the declarations in code and then just the input prompt statements in the query. What is the order of evaluation between queries and events? Any ideas will be most appreciated.
the sort (1-4) is simply to order the records
1-Active Wastehaulers
2-Active buses/other
3-retired wastehaulers
4-retired buses/other
Thanks in advance
lhuffst
the problem is that I need to have all
Code:
strTemp = InputBox("Enter Start Date Range:", "Start Date", dteStart)
If IsDate(strTemp) Then dteStart = CDate(strTemp)
strTemp = InputBox("Enter End Date Range:", "End Date", Format(dteEnd, "mm/dd/yyyy"))
If IsDate(strTemp) Then dteEnd = CDate(strTemp)
lblreportdates.Caption = Format(dteStart, "mm/dd/yyyy") & " - " & Format(dteEnd, "mm/dd/yyyy")
[highlight #AD7FA8]'txtdatestart.Value = Format(dteStart, "mm/dd/yyyy")
'txtdateEnd = dteEnd[/highlight] These were unbound text boxes on report so I could pass the date info but says I cannot assign a value to the object.
strFilter = strFilter & "( [retireDate] > #" & dteEnd & "# AND [effectiveDate] Between #" & dteStart & "# AND #" & dteEnd & "# )"
strFilter = strFilter & " OR "
strFilter = strFilter & "( [effectiveDate] < #" & dteStart & "# AND [RetireDate] Between #" & dteStart & "# AND #" & dteEnd & "# )"
strFilter = strFilter & " OR "
strFilter = strFilter & "( isNull( [retireDate]) AND [EffectiveDate] Between #" & dteStart & "# AND #" & dteEnd & "# )"
strFilter = strFilter & " OR "
strFilter = strFilter & "( [retireDate] Between #" & dteStart & "# AND #" & dteEnd & "# AND [effectiveDate] Between #" & dteStart & "# AND #" & dteEnd & "# )"
I'm getting all the correct data but now need to sort the report.
This is what I have so far (columns were separated just for readibility. they are actually in a continuous line:
Code:
=IIf(Left([PermitNo],2)="WH" And (IsNull([RetireDate]) Or [RetireDate]>[txtdateEnd]),"1",
IIf(Left([PermitNo],2)<>"WH" And (IsNull([RetireDate]) Or [RetireDate]>[txtdateEnd]),"2",
[b]IIf(Left([PermitNo],2)="WH"[/b] ,"3","4")))
When I build it one piece at a time, it works but when I put it together I get an error saying I have to many characters or am missing a } or |.
I think a better method may be to put the input prompt in the query but I wasn't sure if I could do the declarations in code and then just the input prompt statements in the query. What is the order of evaluation between queries and events? Any ideas will be most appreciated.
the sort (1-4) is simply to order the records
1-Active Wastehaulers
2-Active buses/other
3-retired wastehaulers
4-retired buses/other
Thanks in advance
lhuffst
the problem is that I need to have all