General :: Toggle Option - Converting Values To Words
Oct 7, 2013
I have form using a toggle option with four buttons. The values are 1,2,3 & 4. How can I convert the values to read (in the table) as words instead of values.
I am creating a database which has an invoice printing form. In that I would like to have a column for the total amount in words. I have got a sample module from northwind database. According to that 100,000 is "one hundred thousand" but in my country that is pronounced as " 1 Lakh" and for one million it is 10 lakh, for 10 million it is 1 crore like that. Is that possible to change the code in that module to display the words according to our standards? I am attaching the code with this thread. If anybody can show how to do that...I will be thankful to them..
Thanks
Function ConvertCurrencyToEnglish(ByVal MyNumber) Dim Temp Dim Dollars, Cents Dim DecimalPlace, count
' If we find decimal place... If DecimalPlace > 0 Then ' Convert cents Temp = Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2) Cents = ConvertTens(Temp)
' Strip off cents from remainder to convert. MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If
count = 1 Do While MyNumber <> "" ' Convert last 3 digits of MyNumber to English dollars. Temp = ConvertHundreds(Right(MyNumber, 3)) If Temp <> "" Then Dollars = Temp & Place(count) & Dollars If Len(MyNumber) > 3 Then ' Remove last 3 converted digits from MyNumber. MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If count = count + 1 Loop
' Clean up dollars. Select Case Dollars Case "" Dollars = "No Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select
' Clean up cents. Select Case Cents Case "" Cents = " And No Cents" Case "One" Cents = " And One Cent" Case Else Cents = " And " & Cents & " Cents" End Select
ConvertCurrencyToEnglish = Dollars & Cents End Function
Private Function ConvertDigit(ByVal MyDigit) Select Case Val(MyDigit) Case 1: ConvertDigit = "One" Case 2: ConvertDigit = "Two" Case 3: ConvertDigit = "Three" Case 4: ConvertDigit = "Four" Case 5: ConvertDigit = "Five" Case 6: ConvertDigit = "Six" Case 7: ConvertDigit = "Seven" Case 8: ConvertDigit = "Eight" Case 9: ConvertDigit = "Nine" Case Else: ConvertDigit = "" End Select
End Function
Private Function ConvertHundreds(ByVal MyNumber) Dim result As String
' Exit if there is nothing to convert. If Val(MyNumber) = 0 Then Exit Function
' Append leading zeros to number. MyNumber = Right("000" & MyNumber, 3)
' Do we have a hundreds place digit to convert? If Left(MyNumber, 1) <> "0" Then result = ConvertDigit(Left(MyNumber, 1)) & " Hundred " End If
' Do we have a tens place digit to convert? If Mid(MyNumber, 2, 1) <> "0" Then result = result & ConvertTens(Mid(MyNumber, 2)) Else ' If not, then convert the ones place digit. result = result & ConvertDigit(Mid(MyNumber, 3)) End If
ConvertHundreds = Trim(result) End Function
Private Function ConvertTens(ByVal MyTens) Dim result As String
' Is value between 10 and 19? If Val(Left(MyTens, 1)) = 1 Then Select Case Val(MyTens) Case 10: result = "Ten" Case 11: result = "Eleven" Case 12: result = "Twelve" Case 13: result = "Thirteen" Case 14: result = "Fourteen" Case 15: result = "Fifteen" Case 16: result = "Sixteen" Case 17: result = "Seventeen" Case 18: result = "Eighteen" Case 19: result = "Nineteen" Case Else End Select Else ' .. otherwise it's between 20 and 99. Select Case Val(Left(MyTens, 1)) Case 2: result = "Twenty " Case 3: result = "Thirty " Case 4: result = "Forty " Case 5: result = "Fifty " Case 6: result = "Sixty " Case 7: result = "Seventy " Case 8: result = "Eighty " Case 9: result = "Ninety " Case Else End Select
' Convert ones place digit. result = result & ConvertDigit(Right(MyTens, 1)) End If
Say I have two bubbles (options,buttons, whatever you know them as) I want the system to be set up so that only one of the two can be "true" at a time. Say they are titled Option1, and Option2. What code would I put on them so only one can be "true" at a time. If Option1 was true, and then someone clicked on option2, I want it to cause option 1 to go false.
I have an option group with two toggle buttons. Is it possible to set up the option group such that only one toggle button is visible at any given time (i.e. the unselected option) So the group has a default value. Clicking the visible button should switch the value, hide the button (option) associated with that value and show the alternate button (option) for the alternate value?
Basically only having one visible button at any given time which toggles between the two values (but I'd like to retain it as an option group, rather than as two independent buttons, as that gives me a handy value from which to determine control sources elsewhere)
I've tried setting the visibility of the buttons from the AfterUpdate event of the option group but it doesn't work.
I know I can do this with independent buttons but was hoping there was a quick(er) and easy way to do it with an option group instead?
I have an option box 1=Yes, 2=Np 3=Unknown. the result is stored in a field in my table. When i run a query I pull up the numbers 1, 2 or 3 but to put in a report I actually want the written answers. How do i convert them back?
I have a travel time database that should tally the number of minutes traveled and convert them into a time (hours and minutes). I, however, am having difficulty converting the numeric values cleanly. Is there anyway to convert 102 minutes + 100 minutes + 110 minutes = 312 minutes to 5 hours and 12 minutes cleanly? I need to take averages of time traveled and hours worked but cannot do this correctly. Thank you for any help in advance.:eek:
I am attempting to split out a descriptive field so that each words which may exist in that particular field will be split out into seperate fields ... for example, if the violation field is populated with a four worded description of 'Assualt on Police Officer' I would like to somehow strip out the words so that 'Assualt' and 'on' and 'Police' and 'Officer' are all in seperate fields. I am not sure if this can be done using a simple query in access ... if anyone can offer any suggestions, I would greatly appreciate it.
I have got a DB being used in the office, its a big one so obviously it has quite a large number of tables and forms, alotta the forms are either split forms or have related tables inside them (and in a few cases both)
Everything working fine but people in the office are getting confused, as there are many fields in some of these tables I've set default values to make things easier for everyone, however when people look at the info on the DB they sometimes see a new record, with some fields seemingly filled in (default values) and hence assume its a record that exists which caused confusion
I've attempted to explain that a star on the left hand side indicates a new record which doesnt exist, however this just adds to their confusion..... (seriously makes me wanna facepalm), anyways im thinking it might be simpler if there were a way to toggle on or off the new records row (or hide/unhide it)
of cuorse i know this may cause problems, as if im successful some people will go "hey what happened to the star in it?" or simply ignore the last row outta habit, however i figure ill cross that bridge when i come to it.....
I'm trying to show the modal value of a column in a query that only has text in, not numbers. I want to present this in a text box in a report.
My report already has a query as its record source that only shows data for a given year and given month, these are chosen using parameters created in the query. Thus all I need to figure out is how to show the modal value for the column "Categories" on the report somehow.
I have a frame on a form with 2 toggle buttons in it - i want to be able to toggle the buttons to set criteria for a query which i can load as a report from clicking a button - is it possible to do with IFF? or is there an easier way - is it possible to have the report as a sub-report on the form and it to change when i toggle the buttons?
Just tried out ControlTip Text on some command and toggle buttons. The text pops up on some but not on others and I cannot determine what the difference is (the properties are essentially the same except for name, caption etc). What buttons work and what do not seems random but if I copy/paste a button that works, the copy always seems to work.
Hi all, need some help. In my query I have 4 fields, a weekly labour cost, weekly material cost, weekly plant cost and a weekly summary. The problem I have is that my weekly summary shows a null value on some weeks as not all the weekly costs have a value assigned to them.
I have been told there is a way in the query to convert Null values to zero so that the weekly summary field doesn't show a blank cell.
Could someone please explain to me how this is done? Thanks
I have a SubForm "assignments" based on a Query, which has criteria to filter dates and also to filter 0 and 1 of the checkbox ...
The question is:
How do I put in that SubForm one or more Checkbox to "enable" and "disable", only the criteria of such query? So, toggle, for example, those jobs that are not completed (Checkbox of the query=0) and those that do ...
Here is an example of a report where I'm having the trouble:
Client Name _____ Yr 1 ______Yr 2 _____ Yr 3
A ______________50_________47_______62 B ______________ __________30_______85 C _____________121_________ _______100
Basically what I want to do is put a "0" where the blanks are above (Client B Yr 1 and Client C Yr 2). The problem is that in the table where I have the data stored, Client B doesn't even exist for Yr 1. It just has data for Yr 2 and Yr 3. I'm running a crosstab query off of the table to generate the report so I can make yearly comparisons. Is there a way in the query to add a zero where there are blanks, or do I have to actually go in manually and create an entry for Client B in Yr 1? I've tried =IIf(IsNull([Amount in Year]),"0",[Amount in Year]) and things like that, but they haven't been working. Any ideas?
Hi, I am converting a database from Access 2002 to Excel 2002 but when converted each value in the spreadsheet has the value ' directly before it. Is there anyway around this problem.
how data is best structured in Access.I have a table of values (for instance: weight) and I need to be able to look up a weight based on the column header (age) and row header (height).How is this sort of data best structured and accessed in Access?
Hello, I am not sure what cateogory to choose for this question but I would greatly appreciate your help.
I have 5 buttons in my option group: 1. very often 2. often 3. occasionally 4. rarely 5. never
I have to produce a report using description of each button in my report, not numeric value. I heard something about global variable but I am not sure how to do it.
I have five Option Groups on my form. I was running into a problem where after selecting options for one record and then moving onto the next record, the previous options would stay selected for the new record.
I "thought" I had found a solution by setting the Option Group values to Null in the OnCurrent event of the form, but I found a problem in that when going back to a previous record, it is nulling out the previously selected options. Doh!
Any ideas on how to get around this problem? I want to be able to go from one record to the next without carried over options, but I also want to be able to go back to already entered records without having them nulled out.
I have created an option group with two buttons (New, Used). In another text box I used a formula taking values true or false on option group. The formula is not working. It goes like this.
I inserted an option group with 3 checkboxes (Yes, No, Re-open). My problem is that I see the values of these checkboxes (1=yes, 2=no, 3=re-open) in my table. I want to see just text and no number. How's that possible ?
I have a program abc.mdb and abc.mde, I made some changes to the codes in abc.mdb and now I have been trying to convert the access file from abc.mdb to abc.mde so that the users are able to use the updated file. However, whenever I make MDE file. It doesnt work but creates another file called db1.mdb instead.
Hi, im after a option group that stores multiple values, the only way, long winded as it will be is to create a table with all the values then have tickboxes for all of them.
I want to create an opion group with two rad buttons in it. The values of those button wont be values but as true or false in order to use it in another text box to performa calculations. EX.
=IIf([radNew],"Hello",IIf([radUsed],IIf([txtAgeofCar]<184,[txtExciseinTotal]=Null,IIf([txtAgeofCar] Between 185 And 365,[txtExciseinTotal]*(-0.15),IIf([txtAgeofCar] Between 366 And 1095,[txtExciseinTotal]*(-0.2),IIf([txtAgeofCar] Between 1096 And 1825,[txtExciseinTotal]*(0),IIf([txtAgeofCar]>1825,[txtExciseinTotal]*(0.25))))))))
As you can see radNew and radUsed are the Options Buttons. Its not working in an option group.
I am designing a database for our audit teams to carry out reviews of our claims handlers and have put next to each of the questions on a form an option group of three option buttons, "Yes", "No", "Not Applicable" with the values "1", "-1" and "0" respectively. This value is then stored in a table under the relevant field, intQuestionValue, for Q1, Q2, Q3 etc.
This works well for calculating scores, percentages etc. for all the questions. However the manager of the team has said that there will be times when he wants to report by the number of "No" answers for example, so that he look at trends and build these into training plans etc.
I do have a table, tblScores, which has two columns in it. One for the text element, "Yes", "No", "N/A" and the other has the corresponding numeric value in it.
Because there are numerous questions i cannot seem to create a join in a query for the numeric value to bring back the text value. The only other method that came to mind was to write the text outcome to a table as well at the same time, but I'm not sure how I would do this at the same time as clicking the option button, or would it all save when i (the user) closes the form?
Is there an easy way to convert an old ACCESS db from version 2003 to version 2010?
My ACCESS db is .mdb and I want to convert it to .accdb as version 2010. It has hundreds of modules that may take awhile to export. Exporting is the only way I know to transfer from one db to another.