i have written following code in access vb:
strsqlpay = "select * t_payment " & _ "where studentid = " & me.id.value & _ " , schoolyear = """ & year.value & """" set recsetpay = currentdb.openrecordset(strsqlpay) countpay = recsetpay.recordcount
the t_payment
table contains following information:
id studentid schoolyear semester paymenttype checknumber amountdue amountpaid datepaid 4 468 13 fall check 100 $130.00 $130.00 29-jul-16 5 468 13 spring check 101 $60.00 $60.00 29-jul-16 9 468 14 fall check $190.00 $190.00 29-jul-16 11 1 12 fall cash 0 $1.00 $1.00 07-mar-16
a form triggers code , gives studentid = 468 , schoolyear = 14. count returns 3 records. not looking for. if take same statement , run in query looking 1 record.
i need figure out how expand select statement include semester = "fall" can not figure out how add , make work.
i hope have given enough information me.
please can me, thank you!
strsqlpay = "select count(*) reccnt " & _ " t_payment " & _ " studentid = " & me.id.value & _ " , val(schoolyear) = " & me.year.value & _ " , ucase(semester) = ""fall""" set recsetpay = currentdb.openrecordset(strsqlpay) countpay = recsetpay.fields("reccnt").value
this assumes schoolyear alpha , me.semester has "fall" or "spring" in it. also, haven't run code, might have typo in it.
Comments
Post a Comment