Dim Sql, CurrentDate as String
Dim TrDate as Date
Dim DataVal As Integer
TrDate=DateTime.Now
CurrentDate=Format(TrDate, "dd/MM/yyyy hh:mm:ss tt")
Sql="Select count(*) from Table1 where InvDate<=#" & CurrentDate & "#"
IF DBConOpen()=True
cmdOledb.CommandText = sql
cmdOledb.CommandType = CommandType.Text
cmdOledb.Connection = ConOledb
DataVal = cmdOledb.ExecuteScalar
msgbox(DataVal)
End IF
CurrentDate=Format(TrDate, "yyyy/MM/dd hh:mm:ss tt")
Sql="Select count(*) from Table1 where InvDate<=Now()"