I am trying to write sql query in VBA to fetch data which is sum of inspection_Planned between two date(start date and end date)and then of particular type.
I have written following code to do it
Expand|Select|Wrap|Line Numbers
- Dim strSQL As String
- Dim rs As Recordset
- Set db = CurrentDb
- strSQL = "SELECT SUM(Inspection_Planned) From tblauditplanned WHERE ([Inspection_Palnned_Dte] Between " & Me.txtddjansd & " And " & Me.txtddjaned & ") AND [Inspection_Type] = ' & cmbsarepinsptype & ' "
- Set rs = db.OpenRecordset(strSQL)
- txtsarepjan1 = rs.Fields(0)
plz help
thanks