السلام عليكم اساتذة
لدي مشكلة وهي عدم ظهور النتيجة صحيحة في جملة MySQL
ةخاصة Lblt9e
والتي تقوم بحساب عدد السجلات الموجود بدون تكرار
ارجو التعديل
Me.t9 = Nz(DSum("[Loan_Made]", "[tbl_Loans]", "Year ([Auto_Date])=" & Me.txtYear & " And [Loan_ID] > 0 "), 0) - Nz(DSum("[Payment_Made]", "[tbl_Loans]", "Year ([Auto_Date])=" & Me.txtYear & " And [Loan_ID] > 0 "), 0)
MySQL = ""
MySQL = "Select DISTINCT(Employeeid) From tbl_Loans"
MySQL = MySQL & " Where " & "Year ([Auto_Date])=" & Me.txtYear & "And [Loan_ID] > 0 And ([Loan_Made]-[Payment_Made])=0"
Set rst = CurrentDb.OpenRecordset(MySQL)
Me.Lblt9 = rst.RecordCount
'T9E
Me.T9E = Nz(DSum("[Loan_Made]", "[tbl_Loans]", "Year ([Auto_Date])=" & Me.txtYear - 1 & "And [Loan_ID] > 0"), 0) - Nz(DSum("[Payment_Made]", "[tbl_Loans]", "Year ([Auto_Date])=" & Me.txtYear - 1 & "And [Loan_ID] > 0"), 0)
MySQL = ""
MySQL = "Select DISTINCT(Employeeid) From tbl_Loans"
MySQL = MySQL & " Where " & "Year ([Auto_Date])=" & Me.txtYear & "And [Loan_ID] > 0 "
Set rst = CurrentDb.OpenRecordset(MySQL)
Me.Lblt9e = rst.RecordCount