Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

SQL to filter records from access table in vb6

$
0
0
Hello,

I have this table for a payment log where there are a fields such as the PaymentID, DatePaid, Name. So in this table a single person can be having many payments records with different dates. I need to search this table and get all the records older than a month but I also need only the newest from each individal.

i.e: -
If Person A has paid on Nov 1 2013 and has paid again on Dec 1 2013 I need only the record from Dec 1 2013

I got the sql stament for getting all records older than a month

Code:

DateDue = Month(Date) - 1 & "/" & Day(Date) & "/" & Year(Date)
str = "SELECT * FROM PaymentTable WHERE DatePaid = #" & DateDue & "# ORDER BY PaymentID, DatePaid DESC;"
adodc1.recordsource = str
adodc1.refresh

but i cant figure out how to get it to remove all the records where a individual has a newer DatePaid

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>