Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric data in Character field
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00454206
Message ID:
00454233
Views:
21
>I have a numeric field that is c(17). It will only have numeric data but I will never perform math on it. It is a DDA (checking account) number. I would like to not show the client leading zeros on the form, but store leading zeros on the database. I would also like to display the number in the textbox shifted to the left, like other numeric fields. Want it to act like a numeric field for the client.
>
>1) How do I not show leading zeros in a textbox when the controlsource is a character field?

In the Refresh() you could strip the zeros and set the Value property to that. Leave the Control Source blank. In the LostFocus, you could issue a replace command to update the actual field value in the table or view. If this is needed in multiple places, I would subclass the textbox and add a property called cControlSource where you would store the actual ControlSource without binding the control to the data field. That way you could write generic code in the LostFocus.

>
>2) how can I shift the display in the textbox to the right?

Set the Alignment property to Right

>3) in my save routine I do following code. Does this seem OK?
>
>m.dda_disb = RIGHT("00000000000000000" + ALLTRIM(m.dda_disb),17)

I would use the PADL() function

>if len(alltrim(m.disb_rt_no)) = occurs('0',m.disb_rt_no)
> m.dda_disb = ""
>endif

Is if val(m.Disb_Rt_No) == 0 the same?
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform