Hi there,
I am not sure I understand your situation 100%. Are all records for both fiscal year in the same recordset (if they are present)?, like this:
FY03 Silicon Graphics 800
FY04 Silicon Graphics 800
FY04 Microsoft 700
while another search may result in this:
FY04 Silicon Graphics 800
FY04 Microsoft 700
If that's the case, you can simply look at the values in the recordset, and see if they match your criteria. For this to work, you'll need to add the fiscal year somewhere (as a column in your query for example) and you'll need to sort the results on this fiscal year:
Code:
Dim FY03Done
FY03Done = False
Do While Not MyRecordset.EOF
If FY03Done = False Then
' Is the first record. See if 03 is found
If MyRecordset("FY") = "2003" Then
' If 2003 is found, there is no need to display the message
Else
' Recordset does not start with a record for FY 2003,
' so display a message
Response.Write("No records for FY 2003")
End If
FY03Done = True
End If
Response.Write("Recordset value " & MyRecordset("CompanyName"))
MyRecordset.MoveNext()
Loop
This way, the first time the loop runs, you check whether the record is a record for 2003. If it is not, you can display a message. If it is, you can simply output its value.
Depending on your needs for this application, you may need to copy the line that writes out MyRecordset("CompanyName") to inside the loop, so its only outputted when appropriate.
You can expand this example, so it adds the FY above the results, but only when it changes from the previous record.
Does this help?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.