Formatting Binded Textboxes (1 Viewer)

neoartz237

Tensai
Local time
Today, 02:59
Joined
Feb 12, 2007
Messages
65
Im trying to format my textboxes that produces currency formatted values to "K" formats. Basically like 25,000 to 25K

Can I achive this by just changing the format of the binded textboxes or do I need to code it manually, which ofcourse would mean the textboxes wont be binded anymore. But if I do it manually, wont it defeat the purpose of using access in the first place?

Anyway its a repeating form so if I can do it with jusy using Format, it would make my life suck less. Please help
 

ajetrumpet

Banned
Local time
Today, 04:59
Joined
Jun 22, 2007
Messages
5,638
Neo,

You could always put a conditional value in there, couldn't you? If the textboxes are not formatted with a "number" data type, then you could just do this:
Code:
On EventOfYourChoice

  me.textboxname = me.textboxname/1000 & "K"
I don't think you can just change the format, as the "K" abbreviation for "thousand" is probably not a preset format in the program. ;) I don't really think you can set a format here anyway, because every value you put in is going to have to be divided by 1,000. A property doesn't accept calculations.
 

missinglinq

AWF VIP
Local time
Today, 05:59
Joined
Jun 20, 2003
Messages
6,423
First off, 25K is not a currency format! Secondly, you can't change this by using formatting. Thirdly, changing it manually would not keep the textbox from being bound (BTW, binded is not a valid term) as most data, bound or unbound, is entered manually! And lastly, entering data manually doesn't "defeat the purpose of using access in the first place?"

As to your problem:To convert your data entered to a "K" format, you'd need to use some code like this in the textbox's AfterUpdate event:

Code:
Private Sub YourTextBox_AfterUpdate()
 Me.YourTextBox = Replace(Me.YourTextBox, ",", "")
 Me.YourTextBox = (Me.YourTextBox / 1000) & "K" 
End Sub

Good Luck!

Linq
 

neoartz237

Tensai
Local time
Today, 02:59
Joined
Feb 12, 2007
Messages
65
Neo,

You could always put a conditional value in there, couldn't you? If the textboxes are not formatted with a "number" data type, then you could just do this:
Code:
On EventOfYourChoice

  me.textboxname = me.textboxname/1000 & "K"
I don't think you can just change the format, as the "K" abbreviation for "thousand" is probably not a preset format in the program. ;) I don't really think you can set a format here anyway, because every value you put in is going to have to be divided by 1,000. A property doesn't accept calculations.


Thanks! This solved everything.
Almost anyway.
Turns out the control source can be set to =[dblProfit] \ 1000 & "K"
which solved the dilemma.

Oh and sorry for my "binded textboxes" clusterf*ck, my english's broken more often that it should recently. :(

Thanks again ;)
 
Last edited:

missinglinq

AWF VIP
Local time
Today, 05:59
Joined
Jun 20, 2003
Messages
6,423
No problem! Glad we could help you! We see bound, unbound (which is correct) also bind, binded, unbinded, bounded and unbounded, all of which can become confusing!

Looking forward to hearing from you again!

Linq
 
Last edited:

Users who are viewing this thread

Top Bottom