PDA

View Full Version : Odd dbGrid behavior



Nicholas Herlick
25-Jan-2005, 08:09 PM
I have a view consisting of dbForms and a dbGrid accessing the same
database. When a user finds a vendor (parent record), the dbgrid displays
their inventory (child records). As they navigate the dbgrid, the
highlighted record appears in all of the inventory dbforms below the dbgrid.
So at the same time, they see all of the vendor's inventory items and the
highlighted record in detail in the dbforms.

Finding and entering work great. The trouble happens when someone saves a
new record. It saves, but afterward an empty row is inserted at the top of
the grid. Hitting the kFind key at the main vendor i.d. (first entry form)
clears it up. So redisplaying the vendor record eliminates the empty row
when it reloads the inventory into the grid. Another action that removes
that empty topmost row is clicking into the grid.

No data mishap occurs... the save just does a sloppy thing to the grid. I
have tested about a dozen different dbgrid property and procedure changes in
an effort to stub out that unwanted insertion of an empty top row, without
success.

Any ideas would be greatly appreciated. Thanks!

Nick


--
- - - - - - - - - - - - - - - - -

Nicholas Herlick
President
Herlick Data Systems
1348 Magnolia Ave.
Redlands, CA 92373
Phone: 909-798-2898
Fax: 909-792-9651
Email: nick@memsys.com
Web: www.memsys.com

Garret Mott
25-Jan-2005, 10:40 PM
Hi Nick -

2 ideas:

#1 may be completely off the wall, but I figured it was worth a shot. I had
a very similar problem with a dbGrid. Drove me nuts(er).

What I finally figured out was that the first column was a checkbox. Its
unchecked value ("N") was getting saved if I clicked off the row or used the
arrow keys. Redisplaying made it go away. I played with code for hours &
couldn't make it go away (and to this day wonder why, but I'm mostly over it
;-).

My fix was to move the checkbox to the end of the row. Problem solved, as -
not being the first column - it never got set to "Unchecked". To add insult
to injury, the client thought that was a more logical place for it
anyway....

#2 was a grid that displays parts & qty's to receive into inventory. User
changes the qty if need be, then clicks a button to receive 'em. The button
runs old fashioned procedural code (you know, the stuff we can write in our
sleep, and boy is it fast) that updates inventory.

When the loop finished, the grid refreshed 'cause of changes made in the
loop that had just finished. There would be a blank row at the top.

This one I "fixed" by sending a refresh of the grid at the end of the loop.
So - if a user made sure not to blink, he might see a blank line for a split
second, but then it goes away. Of course, if you want the focus to stay on
the same row, you'll have to add code to go back to it after the refresh...

Don't know if any of this is of use, but answering gave me a break from very
boring work.

Garret


"VDF Guidance" <nick@memsys.com> wrote in message
news:7HBrpO0AFHA.1952@dacmail.dataaccess.com...
>I have a view consisting of dbForms and a dbGrid accessing the same
> database. When a user finds a vendor (parent record), the dbgrid displays
> their inventory (child records). As they navigate the dbgrid, the
> highlighted record appears in all of the inventory dbforms below the
> dbgrid.
> So at the same time, they see all of the vendor's inventory items and the
> highlighted record in detail in the dbforms.
>
> Finding and entering work great. The trouble happens when someone saves a
> new record. It saves, but afterward an empty row is inserted at the top of
> the grid. Hitting the kFind key at the main vendor i.d. (first entry
> form)
> clears it up. So redisplaying the vendor record eliminates the empty row
> when it reloads the inventory into the grid. Another action that removes
> that empty topmost row is clicking into the grid.
>
> No data mishap occurs... the save just does a sloppy thing to the grid. I
> have tested about a dozen different dbgrid property and procedure changes
> in
> an effort to stub out that unwanted insertion of an empty top row, without
> success.
>
> Any ideas would be greatly appreciated. Thanks!
>
> Nick
>
>
> --
> - - - - - - - - - - - - - - - - -
>
> Nicholas Herlick
> President
> Herlick Data Systems
> 1348 Magnolia Ave.
> Redlands, CA 92373
> Phone: 909-798-2898
> Fax: 909-792-9651
> Email: nick@memsys.com
> Web: www.memsys.com
>
>

Garret Mott
25-Jan-2005, 10:44 PM
BTW, # 2 was a dbGrid as well, not a plain grid.

"Garret Mott" <garret@automatesoftware.com> wrote in message
news:NSdqaj1AFHA.1952@dacmail.dataaccess.com...
> Hi Nick -
>
> 2 ideas:
>
> #1 may be completely off the wall, but I figured it was worth a shot. I
> had a very similar problem with a dbGrid. Drove me nuts(er).
>
> What I finally figured out was that the first column was a checkbox. Its
> unchecked value ("N") was getting saved if I clicked off the row or used
> the arrow keys. Redisplaying made it go away. I played with code for
> hours & couldn't make it go away (and to this day wonder why, but I'm
> mostly over it ;-).
>
> My fix was to move the checkbox to the end of the row. Problem solved,
> as - not being the first column - it never got set to "Unchecked". To add
> insult to injury, the client thought that was a more logical place for it
> anyway....
>
> #2 was a grid that displays parts & qty's to receive into inventory. User
> changes the qty if need be, then clicks a button to receive 'em. The
> button runs old fashioned procedural code (you know, the stuff we can
> write in our sleep, and boy is it fast) that updates inventory.
>
> When the loop finished, the grid refreshed 'cause of changes made in the
> loop that had just finished. There would be a blank row at the top.
>
> This one I "fixed" by sending a refresh of the grid at the end of the
> loop. So - if a user made sure not to blink, he might see a blank line for
> a split second, but then it goes away. Of course, if you want the focus
> to stay on the same row, you'll have to add code to go back to it after
> the refresh...
>
> Don't know if any of this is of use, but answering gave me a break from
> very boring work.
>
> Garret
>
>
> "VDF Guidance" <nick@memsys.com> wrote in message
> news:7HBrpO0AFHA.1952@dacmail.dataaccess.com...
>>I have a view consisting of dbForms and a dbGrid accessing the same
>> database. When a user finds a vendor (parent record), the dbgrid
>> displays
>> their inventory (child records). As they navigate the dbgrid, the
>> highlighted record appears in all of the inventory dbforms below the
>> dbgrid.
>> So at the same time, they see all of the vendor's inventory items and the
>> highlighted record in detail in the dbforms.
>>
>> Finding and entering work great. The trouble happens when someone saves
>> a
>> new record. It saves, but afterward an empty row is inserted at the top
>> of
>> the grid. Hitting the kFind key at the main vendor i.d. (first entry
>> form)
>> clears it up. So redisplaying the vendor record eliminates the empty row
>> when it reloads the inventory into the grid. Another action that removes
>> that empty topmost row is clicking into the grid.
>>
>> No data mishap occurs... the save just does a sloppy thing to the grid.
>> I
>> have tested about a dozen different dbgrid property and procedure changes
>> in
>> an effort to stub out that unwanted insertion of an empty top row,
>> without
>> success.
>>
>> Any ideas would be greatly appreciated. Thanks!
>>
>> Nick
>>
>>
>> --
>> - - - - - - - - - - - - - - - - -
>>
>> Nicholas Herlick
>> President
>> Herlick Data Systems
>> 1348 Magnolia Ave.
>> Redlands, CA 92373
>> Phone: 909-798-2898
>> Fax: 909-792-9651
>> Email: nick@memsys.com
>> Web: www.memsys.com
>>
>>
>
>

Peter Donovan
2-Feb-2005, 01:29 AM
Hi Nick,
The property that controls whether or not the dbgrid resorts and redisplays
the records after a save is the auto_regenerate property.
Why don't you try turning off auto_regenerate in the dbgrid? (see help)
Regards,
Peter
www.SonataSoftware.US