I am very new to VBA. I am trying to add the two statements below together and get a record count when the two criteria are met. I tried to use an if and statement, but had no luck. Does anyone have any suggestions on how to put these two statements together.
Dim db As DAO.Database
Set db = CurrentDb()
Dim rs1 As DAO.Recordset
Dim strInstrument As String
Dim sglCoupon As Single
sglCoupon = Me.LstCoupon
strSQL = "select Tbl4.* from Tbl4 WHERE Tbl4.[Open Amount] > 0 and Tbl4.[Coupon]=" & sglCoupon
Set rs1 = db.OpenRecordset(strSQL, dbOpenDynaset)
strInstrument = Me.LstInstrument
strSQL = "select Tbl4.* from Tbl4 WHERE Tbl4.[Open Amount] > 0 and Tbl4.[Instrument Name] = '" & strInstrument & "'"
Set rs1 = db.OpenRecordset(strSQL, dbOpenDynaset)
rs1.MoveLast
Debug.Print rs1.RecordCount
rs1.Close
Set rs1 = Nothing
Any help would be greatly appreciated.
Dim db As DAO.Database
Set db = CurrentDb()
Dim rs1 As DAO.Recordset
Dim strInstrument As String
Dim sglCoupon As Single
sglCoupon = Me.LstCoupon
strSQL = "select Tbl4.* from Tbl4 WHERE Tbl4.[Open Amount] > 0 and Tbl4.[Coupon]=" & sglCoupon
Set rs1 = db.OpenRecordset(strSQL, dbOpenDynaset)
strInstrument = Me.LstInstrument
strSQL = "select Tbl4.* from Tbl4 WHERE Tbl4.[Open Amount] > 0 and Tbl4.[Instrument Name] = '" & strInstrument & "'"
Set rs1 = db.OpenRecordset(strSQL, dbOpenDynaset)
rs1.MoveLast
Debug.Print rs1.RecordCount
rs1.Close
Set rs1 = Nothing
Any help would be greatly appreciated.