Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grids 101 - why am I so lost ?
Message
De
14/12/2006 06:24:49
 
 
À
13/12/2006 19:49:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01177450
Message ID:
01177520
Vues:
36
Mike

How I read it: you're specifying that the grid's record source, i.e. the "table" that it's displaying is INVOICE. But you want to display MORE than that, i.e. the part desc info, which comes from the PRODUCTS table. Now grids like to have a "table" as their source, not a hybrid of the two. Obviously, due to normalisation, you don't want the part desc included in the invoice table.

So what you want is a "flat file" or view of the 2 tables' relevant fields in the grid. As Denis said, you should look at views, a sort of merge of the two tables. This can be achieved via your database container, or you can create one using SQL, then programmatically build your grid from this. This "view" is then treated as a "table" in its own right by the grid.

If you're changing the part # of the invoice, via the combo, then you need an updatable view (also acheived via the database).

This strikes me as odd though: I see the grid as a way of displaying what invoices have been made, presumably from some earlier process that created the orders. So how come you're altering the part in an order at this point? If you want to change that how come you don't do it via the order editing/creation form?

If you want some advice on programmatically creating and populating a grid, from an SQL cursor/view, indeed WITH a working selection combo in it, then I'd be happy to send you some code examples.

HTH

Terry

>New to VFP, I've now got about 30 hours into trying to make a grid work with a combo box. Here is a simplified outline of what I am trying to do. Greatly appreciate any suggestions!
>
>I have an invoice detail table(I) and a products table(P). I defined my grid's RecordSourceType=Alias, RecordSource=I etc. I want my grid as follows:
>
>Part# Description Qty Price
>------ ------------- --- -----
>
>Part# - combo box: 0-Dropdown, RowSource=P.PartNo,PartDesc, ControlSource=I.PartNo
> dropdown list will display "Part# | Description"
>
>Description - text box - ControlSource=P.PartDesc (read-only, not saved in I)
>
>Qty - text box: ControlSource = I.Quantity
>
>Price - text box: ControlSource=I.Price
>
>
>My problem is that a grid configured this way behaves quite odd: when the combo's list (Part#) drops down, it clears the instant I press any key. I think VFP is seeking in the Products table, trying to update the Description column? But shouldn't the combo remain dropped down until user selects something, hits ESC etc ? If I change Description column's ControlSource to (none) and its text box's Value property to "Test Description", the Description column will display "Test Description", but ONLY when that column has the focus (blank otherwise). So I guess my question is how do I display a calculated value for a column - regardless of whether column has focus ? Again, setting Description column's ControlSource=P.PartDesc causes all kinds of screwy behavior with the Part # combo box.
>
>I have a hunch I could avoid all these problems if I used an array RowSource for the combo. But I really want to learn from this "episode". I hate giving up :)
>
>Many thanks!
>
>PS. How do you change UT forum messages to use fixed fonts, so columns line up?
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform