format number...

User avatar
sal21
PlatinumLounger
Posts: 4332
Joined: 26 Apr 2010, 17:36

format number...

Post by sal21 »

i can have a number:

42,3
41,8919
28,478
...

ho to update and have a new format:

42,3000
41,8919
28,4780

Tks.

note:
- the value are string format, MyNum as string
- i need a 4 decimal
Last edited by sal21 on 02 Dec 2020, 11:46, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78060
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: format number...

Post by HansV »

Is it a number field or a text field?

And is the comma the decimal separator?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4332
Joined: 26 Apr 2010, 17:36

Re: format number...

Post by sal21 »

HansV wrote:
04 Jun 2019, 10:41
Is it a number field or a text field?

And is the comma the decimal separator?
modified my old post, sorry for delay

And is the comma the decimal separator?, yes

User avatar
HansV
Administrator
Posts: 78060
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: format number...

Post by HansV »

Have you tried Format(MyNum, "0.0000") ?
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: format number...

Post by CData »

it could be implemented at the table level, or at the control at presentation level (form/report). use 'fixed' and then specify 4 digit decimal

User avatar
sal21
PlatinumLounger
Posts: 4332
Joined: 26 Apr 2010, 17:36

Re: format number...

Post by sal21 »

HansV wrote:
02 Dec 2020, 12:05
Have you tried Format(MyNum, "0.0000") ?
GREAT!

User avatar
sal21
PlatinumLounger
Posts: 4332
Joined: 26 Apr 2010, 17:36

Re: format number...

Post by sal21 »

HansV wrote:
04 Jun 2019, 10:41
Is it a number field or a text field?

And is the comma the decimal separator?
Still on..

now myvar is dimensioned As String and the separator is a dot.

i now i can have:

40.663455
16.610637
40.663455
6.61
40.663301
16.610702
40.663294
16.61071
40.648544

i need:
40.663455
16.610637
40.663455
6.610000
40.663301
16.610702
40.663294
16.610710
40.648544

User avatar
HansV
Administrator
Posts: 78060
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: format number...

Post by HansV »

Try

Format(Replace(myvar, ".", ","), "0.0000")
Best wishes,
Hans