Removing a record from my selected Recordset.
- From: "Jordan" <nojunk_allowed@xxxxxxxxxx>
- Date: Wed, 12 Apr 2006 17:37:34 -0400
I have a parts planning system that stores the list of parts in a Pervasive
database like so:
Car - Engine - 1 - 1/1/1999
Car - Tires - 4 - 1/1/1999
Car - StdWheel - 4 - 1/1/1999
Car - StdWheel - 0 - 1/1/2000
Car - MagWheel - 4 - 1/1/2000
What this says in a nutshell is that the car had started with StdWheels in
1999, then in 2000 they were changed to MagWheels. The line for 0 StdWheels
for the same effective date the MagWheels were added is so that you can
print out an older version of this parts list by entering an Effective date.
In this case if you entered 12/31/1999 you should get a list showing that
the StdWheels are part of the list and if you enter today's date you should
see that the 0 Qty for Std wheels supercedes the old qty and now the
MagWheel are part of the parts list.
I need to get the current parts list for the Car out of this using ADO which
means I have to use the Pervasive syntax which the version I have does not
have "Last" as an option so I cannot create a query to order the parts by
date ascending and just take the last of each. Big Time Bummer!\
Here is the function I have to get the Parts List......
Function GetParts( )
Set Conn = New ADODB.Connection
Set rsData = New ADODB.Recordset
MySQL = "Select PartID, Component, QTY, Effective from Structure where
PartType = '123' Order By Component, Effective"
Conn.Open "DSN=MYODBC"
rsData.Open sSQL, Conn, adOpenKeyset, adLockReadOnly
rsData.MoveLast
rsData.MoveFirst
For lRec = 1 To rsData.RecordCount
Debug.Print
rsData.Fields(0);rsData.Fields(1);rsData.Fields(2);rsData.Fields(3);
Next
End Function
------
This returns the Partent, Component, Qty, and Effective Date as follows:
------
Car - Engine - 1 - 1/1/1999
Car - Tires - 4 - 1/1/1999
Car - StdWheel - 4 - 1/1/1999
Car - StdWheel - 0 - 1/1/2000
Car - MagWheel - 4 - 1/1/2000
--------
I need something in my function above that will scroll through the recordset
and just show the last of each unique component so that my list looks like
below where I only get the last StdWheel. I realize that I really don't
need the 0 for the last StdWheel in this case but there are times when I
will need to see the last item even if it is a 0 qty:
------
Car - Engine - 1 - 1/1/1999
Car - Tires - 4 - 1/1/1999
Car - StdWheel - 0 - 1/1/2000
Car - MagWheel - 4 - 1/1/2000
--------
.
- Prev by Date: Re: ADO CACHE
- Next by Date: Re: ADO CACHE
- Previous by thread: Re: Ignoring duplicates in BULK INSERT with ADO and SQL Server 200
- Next by thread: Re: MSDAORA provider not found
- Index(es):