Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I Partition a VFP Database Table into Sections?

Status
Not open for further replies.

fmasin

Technical User
May 3, 2002
163
GB
Hi everyone,

I have a problem. I have got a foxpro database,with a number of tables. Specifically my problem is only with one table....the 'Products table' which contains thousands of records. These products are in three different categories: Frames, Beams and Accessories.
For easy access to these products within the database, is it possible to write some piece of code that will put these products into sections with clear headings as 'Frames','Beams' and 'Accessories'? How can I do this?

Please, someone help me. Thanks and regards,

Francis (f_masinde@hi-lo.co.uk)
 
What I think I would do, is create three 'views' (which are just editable queries) each view would filter for the specific type, therefore you would have a beams view, a frames view and an accessories view which would appear as 3 different tables in the database, and they are updatable to boot!

I don't know your experience level, if you want to know how to set them up in further detail, just reply to this thread and I'll let you know!

Regards

Simon
 
Yes Simon....thank you so much for your response.
Please, I'm very new to FoxPro databases. Could you kindly show me how to.

Thanks and regards,

Francis (f_masinde@hi-lo.co.uk)
 
PUBLIC variable
variable='beam'
SELECT * FROM table_name WHERE table_name.type_field == "&variable"
 
Thanks so much skoko....I will try that and see how far I can go.
Thanks and regards,

Francis (f_masinde@hi-lo.co.uk)
 
There are dozens of uniquely different ways to do what you have described; Simon offered one (an updatable view, to be created through the database editor), and skoko offered a different one (a non-editable query, created through simple SQL).

If you explain what it is you want to do with these "sections" and where you expect their "Clear Headings" to show up, we can help in more detail (and with better focus).

ie: Are you trying to produce a report? If so, an index on the table and a grouping in the report is all you need.
Is this a data entry form where you want several different lists, all updateable? If so, the views are probably a good way to go.
Is this a Lookup List (say in a Combo box) for the user to pick from? Then the read-only cursor from the SQL query is probably the easiest and best.
 
Yes....it's a look up list where a user chooses from. How would I construct the read-only cursor from the SQL query? Sorry for sounding so daft!
some piece of code that would allow a user to pick from Frames, Beams or Accessories. And would I have to build a new exe? Thanks and regards,

Francis (f_masinde@hi-lo.co.uk)
 
I'm afraid you almost certainly will have to build a new EXE after adjusting the program. (the only situation you wouldn't is if everyone running the program is running from a collection of .PRG and .SCX/T form files).

In your form that you want to pick from the table, you'd want to place a combo box, change its rowsourcetype to 3 "SQL Statement", and place in its RowSource property the correct SQL Select statement. Use skoko's pattern to form your SQL statement (if you need help with it, tell us what your table's fields are). Also, change the combo-box's style property to 2 "Dropdown List" to limit the user to just picking from what's provided.

Set the controlsource to point to the field you want to store the picked item in; Make sure the item's ID is among the columns in the Select statement, set the combo box's BoundColumn to point to the item's id column from the Select.

There are other ways to use combo boxes, depending on what you want to do with the picked value. Have fun!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top