records not pasted as desired

G

geebee

hi,

I have the following, intended to append records top tbl_masterpop_resolved
those records for which the [pasted] column is equal to "chargeoff":

DoCmd.GoToRecord , , acFirst

Dim X As Integer
For X = 1 To Me.RecordsetClone.RecordCount - 1

If Me.prevstatus <> "chargeoff" And _
Me.todaystatus = "chargeoff" And _
Not IsNull(Me![CHG_OFF_Date]) Then
With CodeContextObject
.[table_determiner] = "CHARGEOFF"
End With
'also, put in tbl_masterpop_resolved this loan account # with a status of
chargeoff and take this loan account no out of tbl_masterpop_main:
strSQLInsertIntoResolved = "INSERT INTO tbl_masterpop_resolved ( [Loan Acct
#], status, " _
& "PopEnterDt, [chg off date], [loan status], [inventory status], [active bk
flag], " _
& "[active inactive flag], [paid off?], [payoff date], [days delinquent],
[amended this mo?], " _
& "[extended this mo?])" _
& "SELECT tbl_masterpop_main.[Loan Acct #], tbl_masterpop_main.status, " _
& "tbl_masterpop_main.PopEnterDt, " _
& "tbl_masterpop_main.[chg off date], " _
& "tbl_masterpop_main.[loan status], " _
& "tbl_masterpop_main.[inventory status], " _
& "tbl_masterpop_main.[active bk flag], " _
& "tbl_masterpop_main.[active inactive flag], " _
& "tbl_masterpop_main.[paid off?], " _
& "tbl_masterpop_main.[payoff date], " _
& "tbl_masterpop_main.[days delinquent], " _
& "tbl_masterpop_main.[amended this mo?], " _
& "tbl_masterpop_main.[extended this mo?] " _
& "FROM tbl_masterpop_main WHERE tbl_masterpop_main.[pasted] = 'chargeoff';"
DoCmd.RunSQL strSQLInsertIntoResolved
Else
With CodeContextObject
.[table_determiner] = "not table yet"
End With
End If

DoCmd.GoToRecord , , acNext
Next X

If Me.prevstatus <> "chargeoff" And _
Me.todaystatus = "chargeoff" And _
Not IsNull(Me![CHG_OFF_Date]) Then
With CodeContextObject
.[table_determiner] = "CHARGEOFF"
End With
'also, put in tbl_masterpop_resolved this loan account # with a status of
chargeoff and take this loan account no out of tbl_masterpop_main:
strSQLInsertIntoResolved2 = "INSERT INTO tbl_masterpop_resolved ( [Loan Acct
#], status, " _
& "PopEnterDt, [chg off date], [loan status], [inventory status], [active bk
flag], " _
& "[active inactive flag], [paid off?], [payoff date], [days delinquent],
[amended this mo?], " _
& "[extended this mo?])" _
& "SELECT tbl_masterpop_main.[Loan Acct #], tbl_masterpop_main.status, " _
& "tbl_masterpop_main.PopEnterDt, " _
& "tbl_masterpop_main.[chg off date], " _
& "tbl_masterpop_main.[loan status], " _
& "tbl_masterpop_main.[inventory status], " _
& "tbl_masterpop_main.[active bk flag], " _
& "tbl_masterpop_main.[active inactive flag], " _
& "tbl_masterpop_main.[paid off?], " _
& "tbl_masterpop_main.[payoff date], " _
& "tbl_masterpop_main.[days delinquent], " _
& "tbl_masterpop_main.[amended this mo?], " _
& "tbl_masterpop_main.[extended this mo?] " _
& "FROM tbl_masterpop_main WHERE tbl_masterpop_main.[pasted] = 'chargeoff';"
DoCmd.RunSQL strSQLInsertIntoResolved2

Else
With CodeContextObject
.[table_determiner] = "not table yet"
End With
End If

End Sub


The problem is that if there are 3 records with the same loan acct # in
tbl_masterpop_main, exactly 3 times that amount are being pasted into
tbl_masterpop_resolved, with different [pasted] values that are not just
"chargeoff"

whats wrong? yikes!

thanks in advance,
geebee
 

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

Similar Threads

delete query 4
change to UPDATE query 3
query error 3
complex query error 1
fit in code 2
runtime error 3001 invalid argument error message 2
delete query 1
query speed 5

Top