Dim TSDYYMM As String
Dim MaxRunNo As Integer
TSDYYMM = "TSD-" & Format([txt_LoanDate], "yymm")
MaxRunNo = Val( Right( Nz(DMax("[Loan_No]", "[Tb_Loan]", "[Loan_No] Like '" & TSDYYMM & "*'"),"0"),3 ) )
txt_LoanNo = TSDYYMM & Format(MaxRunNo + 1, "000")