dbTalk Databases Forums  

Test if child records exist

comp.databases.paradox comp.databases.paradox


Discuss Test if child records exist in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Frank Cutre
 
Posts: n/a

Default Re: Test if child records exist - 07-29-2006 , 02:41 PM






Hi Randy,

Figures... I'm great for asking the impossible.

Using the a boxOject instead of a buttonObject... BINGO... it works!

THANX for your time... Frank

"Ranman" <rprenphoto (AT) aol (DOT) com> wrote

Quote:
Right now I'm just trying to get the button to change color. It hasn't
yet.

I don't think you can change the color of a standard paradox
pushbutton. You can change the text and text object color.

If you want button color, try placing a box object on the button and
change its color.

Randy




Reply With Quote
  #12  
Old   
Frank Cutre
 
Posts: n/a

Default Re: Test if child records exist - 07-29-2006 , 02:49 PM






Hi Dennis,

Quote:
Did you see the other response? YOu can't change a button's color. Get
something else in there to try the test. Change the color of the text,
change the color of a box. Pop up a message. Etc.
<<
Figures... I'm great for asking the impossible.

Using the a boxOject instead of a buttonObject... BINGO... it works!

FYI, it works in a newValue.event but not in the changeValue.event. Doesn't
matter to me "where", just as long as it works.

BTW, thanx for pointing me to RDAWorldWide.com

THANX again for your time... Frank


"Dennis Santoro" <RDAPres (AT) NoRDASpamWorldWide (DOT) com> wrote

Quote:
Frank,

See below.

Frank Cutre wrote:

Hi Dennis,

Sorry for the delayed response.


Try it in the new value and see what happens when you scroll

Tried it... pButLocations.color won't change

Did you see the other response? YOu can't change a button's color. Get
something
else in there to try the test. Change the color of the text, change the
color of
a box. Pop up a message. Etc.




Also be sure the fields are contained in a record object, not just bare
fields on a form



I hope I'm understanding you correctly. I'm assuming "the fields" you
are
speaking of... is the "one" field... with the changeValue(or newValue)
code
attached to it (and not the fields in the table that the tCursor is
attached to).

Right. The ones the tc are attached to are not on display. Tcs are memory
constructs.

If that's the case then... no can do. The appID.field (the
primary key field for the main table attached to Form1) has to sit "bare"
on
Form1 to accomodate all the other required fields needed for data entry.
A
table object would require a horizontal scroll bar a mile long.

Then you have a real problem. You either have a terrible normalization or
you
need to learn about MROs or both. See my papers on Contanership on forms
and
Normalization on our paradox resources page (Link in my signature). If you
have
not read the Database basics paper yet read that to You almost always want
fields that are bound to tables contained in a record object (tableframe
or MRO)
as otherwise you are missing a lot of basic behaviors. There has been much
discussion on this in the groups you can find and it is discussed in the
papers
I mentioned. Botton line, it CAN be done and SHOULD be.




Also, you don't need the range to have the value twice for a single value
setrange. A single value on the key is treated as exact match.

Done


Not sure why you are using an anytype for the key value. Try using the
same
type as the field (hopefully long int).

smallInt... done


Finally, get in the habit of using a naming convention that makes very
clear
what all your variables are by type. See the faq on naming conventions
for a
good one.

THANX... I checked it out.


Also, if you are just a beginner here I'd suggest you check out my
Database
Basics paper to help learn some best practices and common pitfalls. You
can
get it on our Paradox resources page (link in my signature)

Coooooool doc. Basically, I do follow most all your suggestions. Always
generated my own keys (never have used the autoExcrement field type since
I
accomodate creating keys over a network) but, over the years, I have
wimpped
out on a few of my table disciplines (a couple use PDox's Ref Integrity,
a
couple have 10-12 character filenanmes). Other than that it's getting my
naming conventions in shape. Since I have no desire to write for others
I
really don't need portability strategies.

So... here's where I'm at. The button still doesn't change color. Code
is
attached to the appID.field sitting "bare" on Form1

==========================
method newValue(var eventInfo Event)

var
tcLocations tCursor
siCurrentRec smallInt
endVar

;|| assign current rec's field.value to variable
siCurrentRec = appID.value

;|| open tcLocations
if not tcLocations.open(":fcc:iLocation.db") then
errorShow("Could not open the iLocation.db table")
return
endIf

;|| setRange based on current record
tcLocations.setRange(siCurrentRec)

Try testing this (if not...etc.)



;|| color button dependant on if child recs exist
if tcLocations.Nrecords() <> 0 then
pButLocations.color = red
else
pButLocations.color = gray
endIf

Again, buttons are grey. Test the code with some other indicator.

Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
Offices in the United States and Germany
Providing solutions to health care, business, governments and non-profits
since
1982





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.