422,023 Members | 1,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,023 IT Pros & Developers. It's quick & easy.

Set 'units' of controls, using another controls selection

P: 11
I have a table, form and report set-up for an order form. One of the controls on the form allows currency selection from a combobox, three other controls are numerical controls for prices. Is it possible for the three price controls to take the currency selection from the currency selection control?

All help much appreciated.

Anton
Oct 23 '17 #1

✓ answered by NeoPa

You need to set the .Format property of the TextBox control on your form in that case.

NB. The escape character (\) must be used as Access recognises various different currency symbols simply to mean use the local one. Thus a format string of the following would be required :
Expand|Select|Wrap|Line Numbers
  1. "\#,##0.00"

Share this Question
Share on Google+
12 Replies


PhilOfWalton
Expert 100+
P: 1,042
You are a little unclear in what you want.

Are yo saying that if the price is 12.34 you want to show it as
€12.34 if Euros have been selected
$12.34 if Dollars have been selectes
12.34 if Sterling has been selected?

Phil
Oct 23 '17 #2

P: 11
Exactly....is it possible? I am quite experienced now using Access but I am by no means an expert!
Oct 24 '17 #3

PhilOfWalton
Expert 100+
P: 1,042
Assuming the only field in your combo box is the currency symbol, and that is the bound column then something like this should work:-

Expand|Select|Wrap|Line Numbers
  1. StrPrice = MyComboBox & Format(MyPrice, "General Number")
  2.  
Phil
Oct 24 '17 #4

P: 11
Thank you. I entered this code, withthe control names updated as belo:

Private Sub txtUnit_Price_AfterUpdate()
StrPrice = cboCurrency & Format(txtUnit_Price, "General Number")
End Sub

Unfortunately it didn't have any effect. Does the format of the cboCurrency combobox matter? Currently it is a number format because it is the currency ID number being stored in the field (of the underlying table) rather than the symbol itself. I guess that must stop your code working because the expression is not seing a symbol in the cboCurrency control!

I will try regenerating the structue with the currency symbol stored in the control/field.

Anton
Oct 25 '17 #5

PhilOfWalton
Expert 100+
P: 1,042
I has assumed (obviously incorrectly) that the CboCurrency was based on a table with a single field of the currency symbol.
If it is a 2 column combo box you may need to change the code to:-

Expand|Select|Wrap|Line Numbers
  1. StrPrice = cboCurrency.Column(1) & Format(txtUnit_Price, "General Number")
  2.  
The Column Number starts at 0 so if the RowSource look like this
Expand|Select|Wrap|Line Numbers
  1. CurrencyID    CurrencySymbol
  2.       1           
  3.       2           
  4.       3           $
  5.  
then the currency column is the second column (Column 1)

Phil
Oct 25 '17 #6

NeoPa
Expert Mod 15k+
P: 30,549
Hi Anton.

Why don't you tell us what's in the table and how the ComboBox is populated. From that we can probably work out what you're trying to ask for and suggest a meaningful solution for you.
Oct 30 '17 #7

P: 11
Hello, my appologies for leaving this reply so long, distractions.

The underlying table has ten fields, most are text entry-type. This problem concerns three of the tables fields, shown in the Tbl_Purchase_Order_Foundation_Level.jpg. I feed data into this table from Frm_Purchase_Order_Request, see Frm_Purchase_Order_Request.jpg, which also populates a report.

I am happy for the table to continue to show number format for the Unit_Price and Line_Value fields, but I would like the controls on the form and in the report to have a currency format. Currently is fixed in the controls format selection, but I would like the selection in the Currency control Combo box to govern the format of the Unit_Price and Line_Value controls.

I tried the code suggested but it wouldn't work for me, which I am sure is my fault rather than an issue with the code itself.

Anton


Attached Images
File Type: jpg Tbl_Purchase_Order_Foundation_Level.JPG (11.3 KB, 37 views)
File Type: jpg Frm_Purchase_Order_Request.JPG (13.2 KB, 36 views)
Nov 6 '17 #8

NeoPa
Expert Mod 15k+
P: 30,549
Hi Anton.

Your pictures have so little background it's hard to see what's a table and what's a form. Your explanation doesn't make it any clearer. What exactly is your problem?
Nov 12 '17 #9

P: 11
Good morning NeoPa,

I would like to select a currency symbol in one control, and have this currency symbol apply to two other controls. Referring to the jpg, Frm_Purchase_Order_Request (the form, which is tabular rather than columnar) I select , $ or € in the 'Currency' control, and I would like the control 'Line Value' to have the same currency symbol shown.

Does that make sense?

Anton
Nov 13 '17 #10

NeoPa
Expert Mod 15k+
P: 30,549
You need to set the .Format property of the TextBox control on your form in that case.

NB. The escape character (\) must be used as Access recognises various different currency symbols simply to mean use the local one. Thus a format string of the following would be required :
Expand|Select|Wrap|Line Numbers
  1. "\#,##0.00"
Nov 13 '17 #11

P: 11
Thank you very much.
Nov 14 '17 #12

NeoPa
Expert Mod 15k+
P: 30,549
I'm glad I could help Anton :-)
Nov 15 '17 #13

Post your reply

Sign in to post your reply or Sign up for a free account.