• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Another set of code, need to understand this as well

rs.Update

If rs("fix var").Value <> OldFIXVar Then
rsTrace.AddNew
rsTrace("ID").Value = rs("ID").Value
rsTrace("Field").Value = "Fix Var"
rsTrace("OldVal").Value = OldFIXVar
rsTrace("NewVal").Value = rs("fix var").Value
rsTrace("Update Reason").Value = 39
rsTrace.Update
End If
 
Hi Ashish.
Rather than posting an entire macro and asking for us to explain everything, perhaps you could limit it down to the specific parts you are having trouble with? In general, all of the macros you've posted so far tend to be database queries, which then extract info from that query and/or update the database. While all of us here don't mind helping out, do mind that it's all volunteer work, and we don't like feeling that we are wasting our time explaining things that you already know (hence limiting your question to specific lines sometimes).

For other readers, earlier discussion on explaining macros was here:
http://chandoo.org/forum/threads/vba-code-decoding.12407/#post-72949
 
Sorry...I have pasted the entire coding accidentally.
I need help for some part in this coding like....

If rs("fix var").Value <> OldFIXVar Then
rsTrace.AddNew
rsTrace("ID").Value = rs("ID").Value
rsTrace("Field").Value = "Fix Var"
rsTrace("OldVal").Value = OldFIXVar
rsTrace("NewVal").Value = rs("fix var").Value
rsTrace("Update Reason").Value = 39
rsTrace.Update
End If
 
Also, need help on this part

Set rs = db.OpenRecordset(sql)
intCounter = 3
Do Until rs.EOF
Cells(intCounter, 1) = rs("Expr1").Value
Cells(intCounter, 2) = rs("adj_reason").Value
Cells(intCounter, 3) = rs("book").Value
Cells(intCounter, 4) = rs("mkt").Value
Cells(intCounter, 5) = rs("par").Value
intCounter = intCounter + 1
rs.MoveNext
Loop
 
Sorry...I have pasted the entire coding accidentally.
I need help for some part in this coding like....

If rs("fix var").Value <> OldFIXVar Then 'If the fix var value in the dataset does not match stored value in OldFIXVar
rsTrace.AddNew 'Create new record
rsTrace("ID").Value = rs("ID").Value 'Set values for new parts in the new record
rsTrace("Field").Value = "Fix Var"
rsTrace("OldVal").Value = OldFIXVar
rsTrace("NewVal").Value = rs("fix var").Value
rsTrace("Update Reason").Value = 39
rsTrace.Update 'Update the dataset
End If


Also, need help on this part

Set rs = db.OpenRecordset(sql) 'Set rs to the returned dataset
intCounter = 3
Do Until rs.EOF 'Do a loop until the end
Cells(intCounter, 1) = rs("Expr1").Value 'Set several cells (rowNumber, columnNumber) to a value from dataset
Cells(intCounter, 2) = rs("adj_reason").Value
Cells(intCounter, 3) = rs("book").Value
Cells(intCounter, 4) = rs("mkt").Value
Cells(intCounter, 5) = rs("par").Value
intCounter = intCounter + 1 'Increment the counter
rs.MoveNext 'Go to next record in dataset
Loop

See quotes above.
 
Back
Top