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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grids questions regarding data fields

Status
Not open for further replies.

Keepontrying

Programmer
May 12, 2003
67
0
0
US
Inside my grid I have 5 columns. In the text field for each item under the controlsource I define the table such as item.qty etc for each row

When I run my form it pull the data field in order of the way it was created:
example:

My Grid field are qty, item, description, price total

My table is create like itemid,custid,invoiceid, etc.

When I run my form
the qty field is the itemid,
the item is the custid etc.

So if I rearrange my field in the table. in the order of the grid it work.
So why is this?

Thanks ahead of time
John
 
How did you build the Grid, via the builder wizard? or programmatically?

Also, how do you fetch the data? or the recordsoruce? via a cursor, alias, sql, etc?

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Hi JOhn

If you open a table and drop a grid with only recordsource specified as the table, the grid will autopopulate in the order of the fields as it it exists in the table.

There are two ways, you can change it.
One is to build the grid in the visual designer and set the grids columns.. source with the appropriate field - one by one. Another way is to change the column display order of the grid in the visual designer. i.e. if you drag and drop the table from the DE into the forms canvass and then change the column order.

Yet another way is to build it in the forms init event..
WITH THISFORM.Grid1
.RecordSource = "myTable"
.Column1.ControlSource = "myField1"
.Column1.Header1.Caption = "myHead1"
.Column1.Width = 120
.Column2.ControlSource = "myField2"
.Column2.Header1.Caption = "myHead2"
.Column2.Width = 120
ENDWITH

etc.. by code.

:)




____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
Merry Christmas & Happy New Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top