Richard Teasdale
asked on
set order of a table by two fields vfp
Hi: ongoing purchase order system in vfp. Now creating stocksheets and I have grouped my stock codes by type.
My stocksheets print out in group order, then listed by code number. To easily key from the completed sheets into the database I need my 'stockcount' table to mirror this exactly; sorted by type then code..
So I need to order a table by TWO fields, not one.
I have in the button on the form that populates the bare stockcount table at present:
"SET ORDER TO pkey ASCENDING"
But I need to order by field 'type' first, then pkey if possible.
Have tried "SET ORDER TO type, pkey ASCENDING"...but just knew it was going to fail.
I could run a query to create an intermediate table but what the heck; you guys are great.
And if Olaf answers, I owe you one for answering my dumb ocx question the other day.
My stocksheets print out in group order, then listed by code number. To easily key from the completed sheets into the database I need my 'stockcount' table to mirror this exactly; sorted by type then code..
So I need to order a table by TWO fields, not one.
I have in the button on the form that populates the bare stockcount table at present:
"SET ORDER TO pkey ASCENDING"
But I need to order by field 'type' first, then pkey if possible.
Have tried "SET ORDER TO type, pkey ASCENDING"...but just knew it was going to fail.
I could run a query to create an intermediate table but what the heck; you guys are great.
And if Olaf answers, I owe you one for answering my dumb ocx question the other day.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
that populates the bare stockcount tableIn that accessory sentence you say you have a bare (empty?) table you populate.
You can populate this way in VFP9
INSERT INTO baretable
SELECT ... FROM stockcount WHERE .. ORDER BY type, pkey
(ASCENDING is optional, only DESCENDING not.)
Once you have that report table filled report on this now not so bare table in physical record order. So no compound index is needed.
Bye, Olaf.
ASKER
And thanks to you, olaf. Can I start an olaf/pcelba fan club?
ASKER