B
BruceM
I have a database that is used for Purchase Order, among other things. It
is a standard set-up, with a Vendor table, a PO table, and a junction table
between the two. There is more, but I don't think the details are relevant
to the question at hand.
When a purchase order is started the PK field ReqID is populated with the
next sequential number. After the PO has been approved it is assigned a
number automatically in the PO_Number field.
Sometimes an approved PO needs to be reworked, perhaps due to a pricing
change. In that case a revision of the PO is created. It has the same
PO_Number value, but another field PO_Rev, which is 0 by default, is now 1.
Here is some raw data:
ReqID PO_Number PO_Rev
12 123 0
46 129 0
60 129 1
70 0
71 0
What I want is to show the highest PO_Rev for a given PO_Number:
ReqID PO_Number PO_Rev
12 123 0
60 129 1
70 0
71 0
I know I could do this in a query along the lines of:
SELECT Max(PO_Rev) as MaxRev
FROM tblPO
GROUP BY PO_Number
except that there will be only one grouping level for all records that have
not been assigned a PO number. How can I get around this limitation?
On a somewhat related question, right now I am loading the PO records, then
applying a filter to limit the initial displayed recordset to records that
do not yet have a PO_Number, and POs that have not been fully approved
(based on a few other fields I have not shown). In the course of using the
database people may filter the records by Customer, Sender, date range,
closed POs, and a few other criteria. I have a series of text boxes and
combo boxes in which the user can select the criteria. This causes a filter
string to be built, then applied.
The question is whether I would do better to load just the default
recordset, then redefine the recordset as the filter criteria are selected.
Essentially I would be using the filter string I am creating now as a WHERE
condition for the recordset SQL, which would be applied in code
(Me.Recordset = strSQL).
It seems to me that the advantage, especially as the number of records
grows, is that a relatively small number of records is being loaded at
first. In many cases it is the only recordset the user will need. If I
understand the advantage correctly, is there a disadvantage?
is a standard set-up, with a Vendor table, a PO table, and a junction table
between the two. There is more, but I don't think the details are relevant
to the question at hand.
When a purchase order is started the PK field ReqID is populated with the
next sequential number. After the PO has been approved it is assigned a
number automatically in the PO_Number field.
Sometimes an approved PO needs to be reworked, perhaps due to a pricing
change. In that case a revision of the PO is created. It has the same
PO_Number value, but another field PO_Rev, which is 0 by default, is now 1.
Here is some raw data:
ReqID PO_Number PO_Rev
12 123 0
46 129 0
60 129 1
70 0
71 0
What I want is to show the highest PO_Rev for a given PO_Number:
ReqID PO_Number PO_Rev
12 123 0
60 129 1
70 0
71 0
I know I could do this in a query along the lines of:
SELECT Max(PO_Rev) as MaxRev
FROM tblPO
GROUP BY PO_Number
except that there will be only one grouping level for all records that have
not been assigned a PO number. How can I get around this limitation?
On a somewhat related question, right now I am loading the PO records, then
applying a filter to limit the initial displayed recordset to records that
do not yet have a PO_Number, and POs that have not been fully approved
(based on a few other fields I have not shown). In the course of using the
database people may filter the records by Customer, Sender, date range,
closed POs, and a few other criteria. I have a series of text boxes and
combo boxes in which the user can select the criteria. This causes a filter
string to be built, then applied.
The question is whether I would do better to load just the default
recordset, then redefine the recordset as the filter criteria are selected.
Essentially I would be using the filter string I am creating now as a WHERE
condition for the recordset SQL, which would be applied in code
(Me.Recordset = strSQL).
It seems to me that the advantage, especially as the number of records
grows, is that a relatively small number of records is being loaded at
first. In many cases it is the only recordset the user will need. If I
understand the advantage correctly, is there a disadvantage?