Selecting specific records

Just had a look and I can see where the problem is. Dim a variable called tempDate as Date and use this:
Code:
  tempDate = rsMain![EventDate]
  Set rsCheck = db.OpenRecordset("SELECT TOP 6 DataBlock.* FROM DataBlock " & _
                                 "WHERE [EventDate] < " & tempDate & " ORDER BY [EventDate];")
 
Ok I have done the following

At the top of your code i have
Dim TempDate as date

Then i have placed
TempDate = rsMain![EventDate] just before the set rscheck SQL statement.

I'm still getting the same thing though - sorry to be a pain
 
if i look at the values on this statement

TempDate = rsMain![EventDate]

Tempdate shows as 00:00:00
rsMain![EventDate] shows as <item not found in this collection>
 
vbaInet my friend you are brilliant. Thank you so much for all your time and effort.

Best Regards
Mike
 
No problemo! Glad we could help.

Just so you're aware, the records of rsCheck are sorted in descending order by EventDate.

Happy coding!
 

Users who are viewing this thread

Back
Top Bottom