UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Decimal Field Changed Depends On Another Field Combobox Selection, Access 2010    
 
   
Alhakeem1977
post Jun 12 2018, 05:52 PM
Post#1



Posts: 102
Joined: 8-July 17



Hi, how can I make a decimal field changed from three digits to two digits based on an another field Combobox KWD or USD as shown below:
1. If I select KWD the decimal field would be 123,123.300
2. If I select USD the decimal field would be 123,123.30
And store it in the table as it is.

If it possible to achieve it works through a VBA code.

Thanks a lot.

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
GroverParkGeorge
post Jun 12 2018, 06:06 PM
Post#2


UA Admin
Posts: 32,787
Joined: 20-June 02
From: Newcastle, WA


Let's explore the reasons behind this specification.

Why would that be necessary? And do you plan to STORE the values with different degrees of precision (2 vs 3), or do you plan to DISPLAY the values differently only?

Frankly, it's hard to imagine a situation where you would actually STORE different degrees of precision that way, although perhaps you would want to DISPLAY it so.

Thanks.

--------------------
Go to the top of the page
 
projecttoday
post Jun 12 2018, 08:51 PM
Post#3


UtterAccess VIP
Posts: 9,691
Joined: 10-February 04
From: South Charleston, WV


Why do you want to "change" the field from USD to KWD? I think what you mean is you want to specify in which currency the number is expressed. So you have to store the currency in the table. Then you would need a currencies table where you would look up the number of decimal places.

--------------------
Robert Crouser

My company's website
Go to the top of the page
 
Alhakeem1977
post Jun 13 2018, 06:11 PM
Post#4



Posts: 102
Joined: 8-July 17



Actually, I would want it for printing data on cheques and for retrieval purposes like to know the cheque prepared by whom and so on.

I've attached the db if you look at it and do the needful if you can.
This post has been edited by Alhakeem1977: Jun 13 2018, 06:12 PM
Attached File(s)
Attached File  CHEQUES_PRINTING.zip ( 803.21K )Number of downloads: 4
 

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
projecttoday
post Jun 14 2018, 10:41 AM
Post#5


UtterAccess VIP
Posts: 9,691
Joined: 10-February 04
From: South Charleston, WV


To whom is post #4 addressed, Alhkeem?

--------------------
Robert Crouser

My company's website
Go to the top of the page
 
RJD
post Jun 14 2018, 11:11 AM
Post#6


UtterAccess VIP
Posts: 8,354
Joined: 25-October 10
From: Gulf South USA


Hi: PMFJI, but it seems you could use the Switch and Format Functions to do this ...

Switch([crr]="BHD",ComboFormat([Amount],"$#,###.000"),[crr]="USD",Format([Amount],"$#,###.00"),True,"")

...or something similar in the right place(s).

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
Alhakeem1977
post Jun 14 2018, 03:38 PM
Post#7



Posts: 102
Joined: 8-July 17



Thanks everyone for your fast responses, unfortunately always I am out from the House.
Rjd I have a few knowledge in MS Access, where I have to put the code you provided? In which field?

I've attached my db in the post No. 4 if you could amend it, if you have time.

Thanks in advance.

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
RJD
post Jun 14 2018, 05:59 PM
Post#8


UtterAccess VIP
Posts: 8,354
Joined: 25-October 10
From: Gulf South USA


Looks like you were essentially there already. I changed the two queries just using Format and adjusted the reports that are called from the form. Is this what you are trying to do?

You can use the Switch function if you are displaying the amounts in the same column in a report, along with the currency type.

HTH
Joe
Attached File(s)
Attached File  CHEQUES_PRINTING_Rev1.zip ( 796.99K )Number of downloads: 1
 

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
Alhakeem1977
post Yesterday, 02:13 PM
Post#9



Posts: 102
Joined: 8-July 17



QUOTE
To whom is post #4 addressed, Alhkeem?


I am so sorry for the delay, it was for you but it answered by RJD.

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
Alhakeem1977
post Yesterday, 02:44 PM
Post#10



Posts: 102
Joined: 8-July 17



QUOTE
You can use the Switch function if you are displaying the amounts in the same column in a report, along with the currency type.


How can I do that in the form itself that I can select the the currency USD then the amount will accept only 2 decimal places or if I select the BHD currency the amount will accept only 3 decimal places.
In addition the amount converter into words function should convert two & three decimal places at the same time.

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
RJD
post Yesterday, 04:03 PM
Post#11


UtterAccess VIP
Posts: 8,354
Joined: 25-October 10
From: Gulf South USA


Well, the more I look into this, the more code I find affecting all sorts of events. And I cannot follow all of this.

You have lots of work to do, including modifications to the function NumberToWords to include Dollars as an option, and the removal of two Lookup fields in the Cheques Details, replacing them with other methods. These besides dealing with the change in decimal precision on the Amount (note that you have set the Amount decimal precision in the table to 0, and it looks like it should be 3 if you want decimal values beyond 0).

If you simply want .00 or .000 as the decimals, and you want to leave decimal precision at 0, then formatting the value as ...

="** " & Switch([crr]="BHD",Format([Amount],"$ #,###.000"),[crr]="USD",Format([Amount],"$#,###.00"),True,"") & " **"

...in a new form textbox or on the report should suffice.

I do not have time now to dig into this, so perhaps someone else can help you with this.

Regards,
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
Alhakeem1977
post Yesterday, 05:02 PM
Post#12



Posts: 102
Joined: 8-July 17



Thank you very much for your response, I am very sorry and in any case thank you very much for the file you provided to me so I will modify it to suit my requirements.

Thank you so much. thanks.gif

--------------------
Best Regards,

Al Hakeem1977
Go to the top of the page
 
RJD
post Yesterday, 07:35 PM
Post#13


UtterAccess VIP
Posts: 8,354
Joined: 25-October 10
From: Gulf South USA


You are welcome. Sorry I could not be of more help. I am assisting a client today.

Regards,
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th June 2018 - 08:55 PM