Need a adjustment to this code?

T

TKM

I need to write a case statement or? if a user selects a certain loan number
I.E. 041-00002119 that certain condition code shows up. We use 4 different
loan number numbers with the beginnings of (041, 040, 020, 011). However code
is old and we now need to add new condition codes and item numbers to the
041 loan numbers. How do I write a statement that looks at expressions to see
if they are true or not then provides me with the correct condition codes in
my subform tabs. Below shows our current code. Please any help would be
gretly appreciated!

Sub UpdateConditionalCheckListItems2(LoanID As Integer)
On Error GoTo Err_Handler
Dim cn As New ADODB.Connection
Dim rstLoanChecklist As New ADODB.Recordset
Dim rstChecklist As New ADODB.Recordset
Dim rst As New ADODB.Recordset
Dim strSQL_Checklist As String
Dim strSQL_LOan As String
Dim rstLoan As New ADODB.Recordset

Set cn = CurrentProject.Connection


strSQL_LOan = "SELECT * from qsubCheckList_Loans WHERE LoanID = " &
LoanID
rstLoan.Open strSQL_LOan, cn, adOpenDynamic, adLockOptimistic

rstLoanChecklist.Open "pplCheckListLoanItems", cn, adOpenDynamic,
adLockOptimistic
'Add Main CheckList Items
strSQL_Checklist = "Select * from pplCheckListItems where
((CheckListActive=True) and (ParentCheckListID Is Null) and
(LoanCriteria<>Null))"
rstChecklist.Open strSQL_Checklist, cn, adOpenDynamic,
adLockOptimistic

While Not rstChecklist.EOF
rst.Open strSQL_LOan & " and " &
rstChecklist("LoanCriteria").Value, cn, adOpenDynamic, adLockOptimistic
If rst.EOF Then
rst.Close
GoTo next_item
End If
rst.Close

rst.Open "Select * from pplCheckListLoanItems where
loanid=" & LoanID & " and masterchecklistid=" &
rstChecklist("MasterChecklistID").Value, cn, adOpenDynamic, adLockOptimistic
If rst.EOF Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top