473,287 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Set 'units' of controls, using another controls selection

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"

12 3712
PhilOfWalton
1,430 Expert 1GB
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
Exactly....is it possible? I am quite experienced now using Access but I am by no means an expert!
Oct 24 '17 #3
PhilOfWalton
1,430 Expert 1GB
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
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
1,430 Expert 1GB
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
32,554 Expert Mod 16PB
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
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, 101 views)
File Type: jpg Frm_Purchase_Order_Request.JPG (13.2 KB, 113 views)
Nov 6 '17 #8
NeoPa
32,554 Expert Mod 16PB
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
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
32,554 Expert Mod 16PB
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
Thank you very much.
Nov 14 '17 #12
NeoPa
32,554 Expert Mod 16PB
I'm glad I could help Anton :-)
Nov 15 '17 #13

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

Similar topics

1
by: Paul Eastabrook | last post by:
Hi, FormView & DetailsView are great controls in the new version of ASP.Net, but I am finding it tricky to display more than the record that either control is bound to at the time. For these...
1
by: itsme | last post by:
Hello Guys, I am trying to add server controls dynamically using XSL. I found an interesting article which shows how to add them dynamically onto the page. But in the article it says that one...
2
by: Amit Pandya | last post by:
Hi This is all using C# and i am new to it. I have a checkbox control that is added programmtically in the page_load event. Now on button click i want to retreive the checkbox control but i...
1
by: john | last post by:
I have two different problems: 1. When the user has clicked on a button that is causing the browser to post back to the server, it could take a little while for the new page to show up. So in...
3
by: Kezza | last post by:
Hi There.. I have dynamically created some textbox and checkbox controls by adding them to a panel. Now I would like to get the values out. I have created a for each loop that I can see the...
3
by: Mr Newbie | last post by:
I am messing around with Web User Controls at present and (think) I have discovered the following. 1.) The identifier for the control in the code behind must match the ID for the control on the...
2
by: Stu | last post by:
Hi, I have a javascript that needs to reference a server control (Listbox1) to check if an item is selected but the server controls are renamed '_ctl0:mainbody:Listbox1' when displayed in a...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
1
by: shapper | last post by:
Hello, I have an array of controls: Dim MyControls() As Control .... How can I add all the controls in MyControls array to a control collection? Thanks,
4
by: Nathan Sokalski | last post by:
I have a section of my code in which I need to know how many child controls a control has. Right now Controls.Count is returning the wrong value, which I realize is because Controls.IsSynchronized...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.