Form Textbox Suffix (1 Viewer)

cosmarchy

Registered User.
Local time
Today, 01:01
Joined
Jan 19, 2010
Messages
116
Hi,



Is there a way to have a textbox suffix like in the same way Excel has custom numbers to append a letter or number to the end of the contents of the textbox but is not actually part of its value?


Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:01
Joined
Oct 29, 2018
Messages
21,447
Can you demonstrate? I am not sure I am following...
 

isladogs

MVP / VIP
Local time
Today, 09:01
Joined
Jan 14, 2017
Messages
18,207
Are you referring to formatting the control so that e.g. 1234 can be displayed as 001234 or as 1234abc or similar?
 

cosmarchy

Registered User.
Local time
Today, 01:01
Joined
Jan 19, 2010
Messages
116
Are you referring to formatting the control so that e.g. 1234 can be displayed as 001234 or as 1234abc or similar?


Yes, this is exactly what I'm referring to :D


For instance, I could enter any number and it will add "kg" to the end ie I enter 123 and the textbox will display 123kg. But when I use the value of this textbox in a calculation, its value is 123.


In comparison, I can add a number number format of '0.00"kg"' to a cell and enter 123 and the cell will display 123kg...
 

isladogs

MVP / VIP
Local time
Today, 09:01
Joined
Jan 14, 2017
Messages
18,207
In the format property of the textbox, enter something like 0.00" kg"
This will automatically add 2 d.p. followed by a space then kg
e.g. 2 => 2.00 kg, 12.5 =>12.50 kg etc

Is that near enough for your needs?
 

missinglinq

AWF VIP
Local time
Today, 04:01
Joined
Jun 20, 2003
Messages
6,423
Or even simpler..you can add a small Label to the right of the Textbox that says "kg."

It has the added advantage of reminding the user of the unit of measure that is to be entered.

Linq ;0)>
 

Micron

AWF VIP
Local time
Today, 04:01
Joined
Oct 20, 2018
Messages
3,478
In the format property of the textbox, enter something like 0.00" kg"
If the control is bound, it cannot be a calculated control, no? (and that includes concatenation) I'm surprised no one asked (or did I miss it?)
But when I use the value of this textbox in a calculation, its value is 123.
You would have to extract the numeric portion because the true value or text of the control is 123 Kg, not 123.

IMHO, the whole idea goes against the most basic fundamentals of normalization IF the intent is to store the contents in a table as 123 Kg ; at least if the numeric part is ever meant to be used or stand alone.
 

isladogs

MVP / VIP
Local time
Today, 09:01
Joined
Jan 14, 2017
Messages
18,207
Whilst I would also use a unit label as Linq suggested, formatting the form control as in my reply does not affect what is stored in the underlying field.
So when 12.50 kg is displayed, the stored value is 12.5 and can be used in a calculation without any additional work. For example:


 

Attachments

  • Capture.PNG
    Capture.PNG
    12.3 KB · Views: 436
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 09:01
Joined
Feb 19, 2013
Messages
16,601
you format form controls in the same way you do in excel - using the control format property option as colin suggests (rather than in excel where format property option is in the ribbon). There are some differences between the options available
 

Micron

AWF VIP
Local time
Today, 04:01
Joined
Oct 20, 2018
Messages
3,478
Colin - thanks! Obviously I have never tried that!
 

AccessBlaster

Registered User.
Local time
Today, 01:01
Joined
May 22, 2010
Messages
5,911
Hi,
Is there a way to have a textbox suffix like in the same way Excel has custom numbers to append a letter or number to the end of the contents of the textbox but is not actually part of its value?
Thanks
I would concatenate them together to visually represent something new, and not save the contrived new value.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:01
Joined
Feb 19, 2013
Messages
16,601
one of the things you can do with access formatting which cannot be done in excel (so far as I am aware) is format for null and display some text

for strings it is

@;"Enter something here"

for numbers (depending on number format required for positive, negative, zero aka excel)

#;#;#;"Enter something here"
 

isladogs

MVP / VIP
Local time
Today, 09:01
Joined
Jan 14, 2017
Messages
18,207
I would concatenate them together to visually represent something new, and not save the contrived new value.

Formatting is being used to represent value and units. There is no contrived new value as the data is unchanged
 

June7

AWF VIP
Local time
Today, 00:01
Joined
Mar 9, 2014
Messages
5,463
Don't confuse Format property setting with Format and FormatNumber functions. Format property does not change the stored value whereas a value modified with function is no longer the stored value. The functions return a string.
 

Users who are viewing this thread

Top Bottom