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

Grid Column Display Problem 1

Status
Not open for further replies.

IForgot

Programmer
Mar 20, 2002
122
US
I have a Grid on a Form.

The form works fine and most of the Grid's columns behave as expected, but one of them is a problem.

The Grid displays record values from a table.
The Grid uses the
RecordSource = Tmp_Invt
RecordSourceType = Alias
The Grid is displaying 6 columns.

Each Text box of the Grid's 6 columns has its ControlSource defined as one of the table's fields
such as: Tmp_Invt.Item_No

Within the table:
Fields 1 thru 5 are characters
Field 6 is a numeric
Field 7 thru 10 are characters

The Table's Fields are directly related to the Grid's columns in that Field 1 is displayed in Grid Col1, Field 2 in Col2, etc. up through Field 6 in Col6

The Grid accurately displays Col 1 thru 5, but Col 6 will not display accurately. Despite my specifically setting its Text box ControlSource to be Tmp_Invt.Royalty, it will not display.

Instead the column is displaying Field 8 (another character field).

Any ideas what is going on and how to resolve it?

Your advice and suggestions are greatly appreciated.

Thanks,
I_Forgot


 


Is this grid base on a cursor or a permanent table?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
What are your column width settings? A value of "0" will make it hard to see...

Brian
 
Mike - I base the Grid on a real table (not a cursor) that is created with an SQL Query (INTO TABLE Tmp_Invt) which executes in a new method (InitTable).

The call to this method occurs in the Form's Load Method:
ThisForm.InitTable

I have used Breakpoints and the Trace Window to examine the table just after its creation by the SQL Query in the Method. The field contents look correct - all 'columns'.

Brian - The MaxLength for the Text Box of this particular mis-behaving column is 6 to allow for 999.99 types of values (if displayed correctly)

As I said, all of the other 5 columns display the correct values and work as expected. It is only this column #6 which does not want to display the values expected.

All of the other columns are based on character fields in the table and this one last column is based on a numeric field N(6,2).

Any suggestions?

Thanks,
I_Forgot
 
IForgot

If you create your recordsource for the grid, from an SQL statement, I would suggest you bring in only the fields required for the grid, rather than extra fields that are not being used in the grid. That sometimes causes the grid to adpapt itself to all the fields available rather than the ones you specified in the controlsources of the columns.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike - thanks for the reply.

Within the SQL Query which creates the table I tried eliminating all but the 6 fields which I want displayed and the Grid continued to misbehave in the same manner.

Some additional info...

This is a VFP6 application.

I originally thought that Column 6 was "skipping" over the desired field and displaying Field 8. With the minimized SQL Query, it is clear that Column 6 is displaying Field #1 (which was already also being displayed in Column 1).

To eliminate any old copies of anything I erased the FXP copy of the CHNG.PRG which executes the
DO FORM MASSCHNG

My testing of this portion of the application is being run from the Command Window and launches an over-all START.PRG (not an EXE).

Thanks for your continued interest and advice.

Thanks,
I_Forgot
 
Despite my specifically setting its Text box ControlSource to be Tmp_Invt.Royalty, it will not display.

Instead of setting the TextBox's ControlSource, set the Column's ControlSource... then it should work.
 
IForgot

I would then re-create your grid. It may have references that are undesirable.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
A star to WGCS for the answer that made everything work correctly.

I also want to thank everyone else for your interest and advice. It was much appreciated.

Thanks,
I_Forgot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top