 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jeff Swanberg Guest
|
Posted: Sat Apr 24, 2004 3:25 pm Post subject: One and only one record checked in table |
|
|
I have a Pdx table with a Logical field. On the data entry form for this
table, I have a DBCheckBox related to this field. I need to write code so
that, when the user checks the box to "True" that whatever other record
currently has that field set to "True" gets switched to "False" so that only
one record has the checkbox checked at any time.
Everytime I try to do this, I get stuck in an endless loop.
Ideas??
Jeff
|
|
| Back to top |
|
 |
Woody (TMW) Guest
|
Posted: Sat Apr 24, 2004 5:32 pm Post subject: Re: One and only one record checked in table |
|
|
"Jeff Swanberg" <jswanberg (AT) swanbergcomputing (DOT) com> wrote
| Quote: | I have a Pdx table with a Logical field. On the data entry form for this
table, I have a DBCheckBox related to this field. I need to write code so
that, when the user checks the box to "True" that whatever other record
currently has that field set to "True" gets switched to "False" so that
only
one record has the checkbox checked at any time.
Everytime I try to do this, I get stuck in an endless loop.
|
Use a separate query to set the field to false in the other records. Also,
you can use a normal check box and set it according to the current record.
That way, you could handle all the code yourself.
HTH
--
Woody (TMW)
Freeware Page: http://users.eonet.net/woodytmw
All computers wait at the same speed.
|
|
| Back to top |
|
 |
Bill Todd (TeamB) Guest
|
Posted: Sat Apr 24, 2004 7:35 pm Post subject: Re: One and only one record checked in table |
|
|
Assuming that there are a large number of rows in the table, I would
do the following.
Index the boolean field.
Use a second TTable connected to the same database table.
Use FindKey on the second TTable to locate the existing checked row.
Uncheck the existing row.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|