Dim prdate As Date = Format(Check_Date.Value, "dd/MM/yyyy") cmd.CommandText = "SELECT MAINFILE.facno, MAX(MAINTRAN.fdate) AS fdate, MAINTRAN.fbalance FROM MAINTRAN INNER JOIN MAINFILE ON MAINFILE.facno = MAINTRAN.facno where MAINTRAN.fdate<='" & Format(prdate, "MM/dd/yyyy") & "' GROUP BY MAINFILE.facno, MAINTRAN.fbalance " With cmd dr = .ExecuteReader End With If dr.HasRows = True Then Do While dr.Read presentdaybal = dr!fbalance Loop dr.Close()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)