Re: Quirks of using controls within a grid

Author: Tina Currie

Posted: 2009-08-24 at 10:11:34

Thanks guys,

I grabbed this little gem off the internet - guy called Andy Kramek. Sounds

pretty much just what you're doing Tracy. It's working a treat!

****The little gem***************************************

LPARAMETERS tcSql, tcAlias

LOCAL lnSelect, lcSql

*** Preserve Work Area

lnSelect = SELECT(0)

*** Cursor does not exist

IF NOT USED( tcAlias )

*** Create it directly

lcSql = tcSql + " INTO CURSOR " + tcAlias + " READWRITE"

&lcSql

ELSE

*** Cursor does exist, use a safe select here

lcSql = tcSql + " INTO CURSOR curdummy"

&lcSql

*** Clear and Update the woirking cursor

SELECT (tcAlias)

ZAP IN (tcAlias)

APPEND FROM DBF( 'curdummy' )

USE IN curdummy

ENDIF

*** Restore work area and return status

SELECT (lnSelect)

RETURN USED( tcAlias )

***********************************************************************

All the best,

Tina

----- Original Message -----

From: "Tracy Pearson" <tracy@powerchurch.com>

To: <profox@leafe.com>

Sent: Thursday, August 20, 2009 11:35 PM

Subject: RE: Quirks of using controls within a grid

>I like to create the grid cursor in the form LOAD event (or grid INIT has

> been used on a project or two) then a gridrefresh method

> selects into gridtempcursor

> select gridcursor

> zap

> append from dbf('gridtempcursor')

> use in select('gridtempcursor')

>

> It's more work, but the occasional grid layout going poof is cured.

>

> Tracy

>

> -----Original Message-----

> From: Dave Crozier

> Sent: Thursday, August 20, 2009 3:23 AM

>

> Sounds like you are resetting the grid Recordsource.

>

> Before you do the query set the recordsource to " " on the grid, then do

> the

> requery and then set it to the cursor you have queried.

>

> If this isn't the reason then is the combobox source an SQL Select or

> another type such as alias or fieldlist? Knowing will help to solve the

> problem but personally I would make the source an SQL select statement

> into

> a discreet cursor.

>

> Dave Crozier

>

>

> -----Original Message-----

> From: Tina Currie

> Sent: 20 August 2009 06:41

>

> Hi all,

>

> First time posting to ProFox - hoping someone can help me as I've wound

> myself into a bit of a knot with this challenge.

>

> I have an order table and I'm grabbing a subset (by SQL query) into a

> cursor

> that is readwrite. I use this cursor as the recordsource for a grid on my

> form. Purpose of the form is to give the user ability to update 1 field -

> they are assigning a truck driver to each order. The driver details are

> from a drivers table and I'm using the firstname field as the rowsource

> for

> a combobox within the grid.

>

> User can choose what data to show in the grid by picking a date range from

> a

> date picker control. Doing this runs the query again and updates the

> grid -

> but every time this happens, I lose the combobox control in column2!

>

> What am I missing?

>

> TIA,

>

> Tina

>

>

>

>

>

>

©2009 Tina Currie