Hi there
Can some one help me with this issue. I have 2 text fields which user selects the date from calender control. Now i want to retreive data from table which falls in the range of these 2 text fields
here is the code i have written. When i run this form it returns the resultset with no rows.(EMPTY resultset)
I have also tried by replacing the above sql stmt to and still no luck
Can some one help me with this issue. I have 2 text fields which user selects the date from calender control. Now i want to retreive data from table which falls in the range of these 2 text fields
here is the code i have written. When i run this form it returns the resultset with no rows.(EMPTY resultset)
Code:
sdate = CDate(Forms![ResolvedIncidentsbySevierity]![Text3]) edate = CDate(Forms![ResolvedIncidentsbySevierity]![Text5]) sql = "select IncidentsResolved.Severity,count(IncidentsResolved .Severity) from IncidentsResolved WHERE ((IncidentsResolved.[Arrival Time] >= " & sdate & ") AND (IncidentsResolved.[Arrival Time] <= " & edate & ")) GROUP BY IncidentsResolved.Severity" Set MyDB = DBEngine.Workspaces(0).OpenDatabase("D:\Reports\db 1.mdb") Set MySet = MyDB.OpenRecordset(sql, DB_OPEN_DYNASET) If (MySet.EOF = False And MySet.BOF = False) Then MySet.MoveFirst level1.Value = MySet.Fields(1) MySet.MoveNext level2.Value = MySet.Fields(1) MySet.MoveNext level3.Value = MySet.Fields(1) MySet.MoveNext ' level4.Value = MySet.Fields(1) Else MsgBox ("No data found") End If MySet.Close Set MyDB = Nothing
Code:
sql = "select IncidentsResolved.Severity,count(IncidentsResolved .Severity) from IncidentsResolved WHERE ((IncidentsResolved.[Arrival Time] >= #sdate#) AND (IncidentsResolved.[Arrival Time] <= #edate#)) GROUP BY IncidentsResolved.Severity"
Comment