From: mactech999 on
Could anyone help me with this translation to CFML please?

If rst.RecordCount = 0 Then
NoRecs
Exit Sub
End If
Numrecs = 1
Do Until rst.EOF
' If next AcesData PartNo is the same as the last due to different MfrLabel,
skip it
Do Until rst!PartNo <> LastPartNo
Numrecs = Numrecs + 1
If Numrecs > rst.RecordCount Then
Exit Do
End If
rst.MoveNext
Loop

From: Dan Bracuk on
I understand the code but it looks incomplete. Is the intent to look for duplicate part numbers?
From: "JR "Bob" Dobbs" on
mactech999,

My VB is a bit rusty but it appears that your code sample is truncated. The
outer do until loop does not appear to be closed.

Questions:
1. is rst an ADO recordset?
2. is this code part of a procedure or function?
3. Is NoRecs a procedure or function that is being called?
4. It appears that the purpose of the loop is to make the value of Numrecs
that number of distinct PartNo values in the recordset. Is this correct?

Explaining what this code is trying to do might clarify things.


From: mactech999 on
Sorry about that here is the code

If rst.RecordCount = 0 Then
NoRecs
Exit Sub
End If
Numrecs = 1
Do Until rst.EOF
' If next AcesData PartNo is the same as the last due to different MfrLabel,
skip it
Do Until rst!PartNo <> LastPartNo
Numrecs = Numrecs + 1
If Numrecs > rst.RecordCount Then
Exit Do
End If
rst.MoveNext
Loop
' Get all Product File part numbers that match the E-Cat number
LastPartNo = rst!PartNo
SqlStr = "Select Product.LineCode, Product.PartNo FROM Product WHERE
Product.ECatNo = """ & rst!PartNo & """ ORDER BY LineCode, PartNO"
Set rst1 = adb1.OpenRecordset(SqlStr)
If rst1.RecordCount = 0 Then
NoRecs
Exit Sub
End If
Do Until rst1.EOF
'Set up Part String so that #, Description, Position & Quantity always line up
'
PartStr = Space(115)
PartStr = rst!Position
Mid(PartStr, 25, 3) = rst1!LineCode
Mid(PartStr, 30, 15) = rst1!PartNo
Mid(PartStr, 48, 50) = Mid(rst!PartTerminologyName, 1, 35)
Mid(PartStr, 88, 10) = rst!Qty
Me.Parts.AddItem Item:=PartStr
rst1.MoveNext
Loop

From: Dan Bracuk on
Forget the vb code. It's easier to do it from scratch. What do you mean by:
"Basically what we want is right now we have 20 parts that come down and they
each have a description,
We want to group them by the description and only show the description after
the last PartNo "
?

Specifically, what do you mean by,
"only show the description after the last PartNo"?