Hello and thanks in advance for the help.

I have a form with two grids. The second grid is a child of the first. In
the AfterRowColChangeEvent of the first grid, I do the query for the second
grid.

I always thought that this problem had something to do with the recordsource
property of the grid but that is apparently not the whole story.

My code in the AfterRowColChangeEvent of the first grid is

thisform.orderdetails.recordsource = ""
select.........into cursor orderinfo readwrite
index on line tag line
go top
thisform.orderdetails.recordsource = "orderinfo"

Why do all the columns get smaller when I run the form for the first time
(and then stay that way)?

I know I could add code to set the column widths back to what I want but why
do they change in the first place?

Thanks,
Jeff

Re: Why do Column Widths Change when I run the form? by Anders

Anders
Thu Feb 14 10:56:18 CST 2008

Un vista parametrizada y un
REQUERY('vista_orderdetails')
El index que aplicas al abrir la vista la primera vez, queda y se refresca.

-Anders

"Jeff Grippe" <jeff@door7.com> wrote in message
news:13r8q9t217trqaa@news.supernews.com...
> Hello and thanks in advance for the help.
>
> I have a form with two grids. The second grid is a child of the first. In
> the AfterRowColChangeEvent of the first grid, I do the query for the
> second grid.
>
> I always thought that this problem had something to do with the
> recordsource property of the grid but that is apparently not the whole
> story.
>
> My code in the AfterRowColChangeEvent of the first grid is
>
> thisform.orderdetails.recordsource = ""
> select.........into cursor orderinfo readwrite
> index on line tag line
> go top
> thisform.orderdetails.recordsource = "orderinfo"
>
> Why do all the columns get smaller when I run the form for the first time
> (and then stay that way)?
>
> I know I could add code to set the column widths back to what I want but
> why do they change in the first place?
>
> Thanks,
> Jeff
>
>
>
>



Re: Why do Column Widths Change when I run the form? by Jeroen

Jeroen
Thu Feb 14 13:37:09 CST 2008

On Thu, 14 Feb 2008 11:17:46 -0500, "Jeff Grippe" <jeff@door7.com>
wrote:

The grid changes width because the recordsource is recreated when you
execute a Select-statement. When the recordsource disappears, the grid
resets itself to the default settings.
The best way to stop the problem is to use a VIEW in the grid, and do
a REQUERY() when the parentinfo has changed

>Hello and thanks in advance for the help.
>
>I have a form with two grids. The second grid is a child of the first. In
>the AfterRowColChangeEvent of the first grid, I do the query for the second
>grid.
>
>I always thought that this problem had something to do with the recordsource
>property of the grid but that is apparently not the whole story.
>
>My code in the AfterRowColChangeEvent of the first grid is
>
>thisform.orderdetails.recordsource = ""
>select.........into cursor orderinfo readwrite
>index on line tag line
>go top
>thisform.orderdetails.recordsource = "orderinfo"
>
>Why do all the columns get smaller when I run the form for the first time
>(and then stay that way)?
>
>I know I could add code to set the column widths back to what I want but why
>do they change in the first place?
>
>Thanks,
>Jeff
>
>
>


Re: Why do Column Widths Change when I run the form? by Dan

Dan
Fri Feb 15 10:19:31 CST 2008

As Anders said in Spanish, use a parameterized view for the child table and
REQUERY() it when the parent record changes. That's exactly what they're
for.

It prevents the grid from destroying itself and reconstructing itself when
its record source closes and reopens, because nothing gets closed.

Dan

Jeff Grippe wrote:
> Hello and thanks in advance for the help.
>
> I have a form with two grids. The second grid is a child of the
> first. In the AfterRowColChangeEvent of the first grid, I do the
> query for the second grid.
>
> I always thought that this problem had something to do with the
> recordsource property of the grid but that is apparently not the
> whole story.
> My code in the AfterRowColChangeEvent of the first grid is
>
> thisform.orderdetails.recordsource = ""
> select.........into cursor orderinfo readwrite
> index on line tag line
> go top
> thisform.orderdetails.recordsource = "orderinfo"
>
> Why do all the columns get smaller when I run the form for the first
> time (and then stay that way)?
>
> I know I could add code to set the column widths back to what I want
> but why do they change in the first place?
>
> Thanks,
> Jeff



Re: Why do Column Widths Change when I run the form? by Jeff

Jeff
Fri Feb 15 10:59:53 CST 2008

Thanks for all the help.

I was able to solve the problem by putting

thisform.orderdetails.recordsource = ""

in the init method of the form.

After that, eveything worked as I expected it to without the grid changing
size.

Thanks again,
Jeff
"Dan Freeman" <spam@microsoft.com> wrote in message
news:uthMO6%23bIHA.5988@TK2MSFTNGP06.phx.gbl...
> As Anders said in Spanish, use a parameterized view for the child table
> and REQUERY() it when the parent record changes. That's exactly what
> they're for.
>
> It prevents the grid from destroying itself and reconstructing itself when
> its record source closes and reopens, because nothing gets closed.
>
> Dan
>
> Jeff Grippe wrote:
>> Hello and thanks in advance for the help.
>>
>> I have a form with two grids. The second grid is a child of the
>> first. In the AfterRowColChangeEvent of the first grid, I do the
>> query for the second grid.
>>
>> I always thought that this problem had something to do with the
>> recordsource property of the grid but that is apparently not the
>> whole story.
>> My code in the AfterRowColChangeEvent of the first grid is
>>
>> thisform.orderdetails.recordsource = ""
>> select.........into cursor orderinfo readwrite
>> index on line tag line
>> go top
>> thisform.orderdetails.recordsource = "orderinfo"
>>
>> Why do all the columns get smaller when I run the form for the first
>> time (and then stay that way)?
>>
>> I know I could add code to set the column widths back to what I want
>> but why do they change in the first place?
>>
>> Thanks,
>> Jeff
>
>



Re: Why do Column Widths Change when I run the form? by tim_witort

tim_witort
Wed Feb 20 00:17:33 CST 2008

Jeff Grippe seemed to utter in news:13r8q9t217trqaa@news.supernews.com:

> Hello and thanks in advance for the help.
>
> I have a form with two grids. The second grid is a child of the first.
> In the AfterRowColChangeEvent of the first grid, I do the query for the
> second grid.
>
> I always thought that this problem had something to do with the
> recordsource property of the grid but that is apparently not the whole
> story.
>
> My code in the AfterRowColChangeEvent of the first grid is
>
> thisform.orderdetails.recordsource = ""
> select.........into cursor orderinfo readwrite
> index on line tag line
> go top
> thisform.orderdetails.recordsource = "orderinfo"
>
> Why do all the columns get smaller when I run the form for the first
> time (and then stay that way)?
>
> I know I could add code to set the column widths back to what I want
> but why do they change in the first place?

If the orderinfo cursor doesn't exist when the grid
is instantiated, all bets are off. When I base a grid
on a cursor that is created or manipulated while the
form is running, I always create the cursor in the
form's Load event - even if it has no records in it.
This will keep the grid happy until you get to the
point of loading the cursor with actual records as
you show in your AfterRowColChangeEvent code.

-- TRW
_______________________________________
t i m . w i t o r t
_______________________________________