Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox problem
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00355920
Message ID:
00355929
Views:
16
>I have a checkbox on page inside pageframe. When the user clicks on checkbox, I should be getting a .T. value. Instead I am getting a value of "1". Here is my code:
>
>insert into employee (checkbx) value (.pf1.p3.chkdrstmt.value)
>
>
>it's giving me an error because checkbx is a logical. Its looking for .T. or .F. and I am returning a value of "1".
>
>.pf1.p3.chkdrstmt.value should have a .T. What Gives??????
>
>
>thanks
>Nick Patel

By default the checkbox.value is numerical. You should change it in the checkbox instance to .F. to have it as logical.
But more reliable approach is use IIF() function to obtain the value for your INSERT

INSERT INTO employee (checkbx) value (IIF(EMPTY(.pf1.p3.chkdrstmt.value), .f., .t.))

In this case you don't care what type the checkbox.value is.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform