Modules & VBA :: Dynamic Number To Decimal Converter
Feb 20, 2015
I've been looking into writing an access form used for hard drive analysis and came across hex values. This made me start dabbling with numbers again and came up with the following function.If you're a person that enjoys playing with numbers, could I get you to think of any scenarios where I could solidify this function to handle errors and become as dynamic as possible!
I think the end result could be useful to add to this communities quick fix library. What it does is take two strings, value and and the definition of how that numbers counts, and with these two values it will spit out the decimal value.
examples:
HEX - "FFF", "0123456789ABCDEF"
OCT - "777", "01234567"
BINARY - "11111110", "01"
Code:
Public Function ConvertStringToDecimal(ByVal str As String, _
ByVal def As String) As Variant
Dim inc As Integer: inc = Len(def)
Dim n As Variant: n = CDec(0)
Dim i As Integer
Dim val As Integer
[code]...
View Replies
ADVERTISEMENT
Apr 11, 2014
I have a subform that displays doubles in a textbox as fixed with 4 decimal places as default. I have been trying to change the number of decimal places based on the value in a textbox on the main form. I have tried this:
Code:
Forms![Main Form]![Holder_subform].Form![Final PCT].[DecimalPlaces] = CByte(Forms![Main Form].Numdecs)
where [Final PCT] is the textbox on the subform containing the decimal number and Numdecs is the textbox on the main form containing the number of decimals I want to use. I want to implement this Form_Current sub.
View 2 Replies
View Related
Oct 25, 2013
Is it possible for a report's displayed decimal places to be conditional.
I have field that has a lab test's name a field that displays the result of the test.
For some tests I only want 2 decimal places, for others I want 4. Is this possible within the same field?
View 2 Replies
View Related
Oct 22, 2007
Hello
my problem is how to reduce decimal number of column in the tables. Problem is that some numbers are quotients and they have a lot of decimal which make a problem in the report where they have to have just 2 decimals.
Column in the query and in the report is not reserved only for numbers.
if some one have idea?
View 1 Replies
View Related
Oct 22, 2007
Hello
my problem is how to reduce decimal number of column in the tables. Problem is that some numbers are quotients and they have a lot of decimal which make a problem in the report where they have to have just 2 decimals.
Column in the query and in the report is not reserved only for numbers.
if some one have idea?
View 6 Replies
View Related
Oct 22, 2007
Hello
my problem is how to reduce decimal number of column in the tables. Problem is that some numbers are quotients and they have a lot of decimal which make a problem in the report where they have to have just 2 decimals.
Column in the query and in the report is not reserved only for numbers.
if some one have idea?
View 1 Replies
View Related
Jul 17, 2007
Is there any PDF file converter driver, free for individuals?
By this driver I want to programmatically give it the path of the file needed to be converted and the path of the created PDF file?
Please help me.
HIGHLY APPRECIATIVE
View 4 Replies
View Related
Nov 18, 2005
Hi,
I have the field set to number -> decial and places to 2.
The CSV document reads 96.133542682
So once imported it should look like 96.13
but it doesn't it is just 96.
Why is this? when the field is text it is the 96.133542682 as it should be.
Thanks
k0r54
View 3 Replies
View Related
Aug 23, 2006
Hi Guys,
How do I create a number field in my table that can store numbers with 2DP?
I have set the format to both Standard and Fixed before, AND specifed 2DP in the drop-down box. But whenever I go to enter in a value, Access just rounds off the decimal place!
View 2 Replies
View Related
Nov 27, 2013
If you specify Number as data type and Decimal as field size for a field in an Access table, will it actually store numbers to the right of the decimal point? I have never been able to get this to work or find these value if they are there and have alwayshad to use field size single or double or data type currency.
View 7 Replies
View Related
Mar 19, 2008
I have Access 2000. I want to update all my records in one table so that they only have 2 decimal places instead of the 10 they have now. What is the expression used to do this?
Thanks
Chad
View 1 Replies
View Related
Dec 17, 2013
Is it possible to have the user enter the number of top records to choose in a query?
I know that you can enter a number or percentage in the Top Values property of the query but I would like the user to be able to enter this number each time they run the query since it may be different each time and not always, say, the top 10 records.
View 12 Replies
View Related
Jan 6, 2008
I have a field for Item Price.
It would be a currency field, but I want it to be able to work with up to 6 decimal places. currency only seems to handle 4.
So, in the table, i changed it to a Single.
In the form, I left the control on Currency.
If I type in $1.43, instead of storing $1.43000000 it stores $1.43003243953
Why is it adding all these bogus sub decimal numbers? Any clue?
Thank you,
Evan
View 5 Replies
View Related
Mar 21, 2015
I've made a crosstab query and would like to use it to create a subreport. In the column headers I have names of courses. Courses can be added or removed. How can I make a crosstab report with dynamic columns?
PHP Code:
TRANSFORM Count(tblCourses.CourseName) AS CountOfCourseName
SELECT tblNmscStaff.NmscStaffFirstName, tblNmscStaff.NmscStaffLastName,
tblNmscStaff.PtOrFtNtl, tblNmscStaff.Ntl, tblNmscStaff.NmscID
FROM tblNmscStaff LEFT JOIN (tblCourses RIGHT JOIN [tblNmscStaff/CoursesPointer] ON
tblCourses.CourseID = [tblNmscStaff/CoursesPointer].CourseID) ON
tblNmscStaff.NmscStaffID = [tblNmscStaff/CoursesPointer].NmscStaffID
GROUP BY tblNmscStaff.NmscStaffFirstName, tblNmscStaff.NmscStaffLastName,
tblNmscStaff.PtOrFtNtl, tblNmscStaff.Ntl, tblNmscStaff.NmscID
PIVOT tblCourses.CourseName;
View 1 Replies
View Related
May 18, 2006
I have a pivotchart which I cause to take a huge list of people's test percentiles and calculate the average for each year. I then display the average above each bar. The problem is that there are too many numbers after the decimal place for each figure. I went into the properties and changed the number format to "fixed" but it doesn't give me the option to change the number of decimal places that are used (it does every where else in MS Office!). It seems that it just uses the regional settings for the computer. But the problem I have in changing that is that I have other pivotcharts in the same report that does something similar but needs a different number of decimal places. Is there any way around this without having to create another query to calculate the average and then having the pivotchart display the info from the new query (this is a huge database that I put together with many charts and I don't want to have to redo the way that it works just because of this decimal place issue)?
View 1 Replies
View Related
Jun 2, 2005
Hi there,
I am not sure the best way to do this,
I have a field with values that look like: 1.69553366385509 or 0.0061705541157596
I want these values to look like: 1.6955 or 0.0062 (4 decimal places [rounded up if possible])
Thanks for your help with this
Sue
View 5 Replies
View Related
Jun 28, 2013
I have the following code for hours worked by staff over a 24hr period. However, I want to calculate staff pay by using their hours worked. The table I am using is populated with the minutes i.e. 270 but I want this field to display 3.5 hrs. I have initially got round this by using a calculated field in the table [Hoursworked]/60*[StaffPay] but this is not an ideal fix. Can I add something to the code below to display the hours to 2 decimal places.
Code
Dim ilHoursWorked
ilHoursWorked = IIf(CDate(Me.txtStartTime) < CDate(Me.txtFinishTime), DateDiff("n", CDate(Me.txtStartTime), CDate(Me.txtFinishTime)), 1440 - DateDiff("n", CDate(Me.txtFinishTime), CDate(Me.txtStartTime)))
View 2 Replies
View Related
Apr 1, 2014
Problem: I want to "round" (to 2 decimal places) numbers 1-5 down and 6-9 up. For example:
1.915 = 1.91
1.916 = 1.92
I know this is completely screwy but I have to match numbers up to a purchasing system that seems to be doing just that.
I've researched rounding in Access a lot and I understand Bankers rounding (that won't work), I understand Int() and Fix() both don't do what I need. I've something about rounding half down (which is what I think I need) or Floor which I don't quite understand.
View 14 Replies
View Related
Sep 4, 2013
My DB is merge in a currency field set to 2 decimal places into word. It's doing this by declaring the fields as variable, calling an instance of work then dropping the values into the bookmarks. All works fine....
When a value is 360.64 is fine, but when it's something that ends with a 0 (360.60) - is loses the 0 giving me 360.6.
View 2 Replies
View Related
Jan 28, 2014
I have text files placed into a folder like AIN28_01012014_1355.txt
I need to import these but the files have the date and time added to the name which i cannot stop AIN28_ will always be the same is there a way to import the file just off AIN_*.txt or something like that
I was thinking i could use file copy and change the name but that needs to know the exact names doesn't it...
View 1 Replies
View Related
Jul 31, 2013
I want to know if it's possible to make a dynamic select case. In my form I have 3 separate combo boxes. What I want to happen is depending on what was selected in one the options in the other two change and if you select something in the second the option in the third narrows down again. The user can select these in any order. They can use one by itself or all three independently. In my code I can do this with many select statements, e.g
Select Case Me.combobox1.Value
Case "choice1"
Forms!CurrentForm!combobox2.RowSourceType = "Table/Query"
Forms!CurrentForm!combobox2.RowSource = "SELECT fieldname FROM tablename WHERE fieldname = '" & Me.combobox1.Value & "'"
End Select
In the place I have "choice" is it possible to write something along the lines of,Me.combobox1.value = "SQL Code"..The idea that this code would still work if the user adds more data to the tables which these combobox choices come from.
View 6 Replies
View Related
Jun 30, 2006
I have a form that shows a list of all of my records in my database. I want to be able to click a button called "Report" and have that print a report that has all the records I have filtered on my form. I have a report in the format that i want it in, however, currently it prints every record and not just what is shown on my form. (The form is dynamic and I want the Report to be dynamically based on the form) HELP PLEASE!
View 6 Replies
View Related
May 20, 2015
I have a button that opens a report. The code behind the button builds the filter criteria for the report based on some selections in a list box.
Code:
DoCmd.openReport "Report", acViewPreview, "", GetCriteria
For VarItem = 0 To Me.List2.listcount - 1
strCriteria = strCriteria & "([ProjectNo]= '" & Me.List2.Column(1, VarItem) & "' And [ClientID] = " & Me.List2.Column(0, VarItem) & ") Or "
Next VarItem
If strCriteria <> "" Then
strCriteria = Left(strCriteria, Len(strCriteria) - 4)
Else
strCriteria = "True"
End If
GetCriteria = strCriteria
This is what the filter would look like with values after running the report (taken from filter bar in report properties):
([ProjectNo]= '150002' And [ClientID] = 206) Or ([ProjectNo]= '150003' And [ClientID] = 79)
Problem is that i only get records for ([ProjectNo]= '150002' And [ClientID] = 206). I this seems only filter ONE set of criteria ignoring all the others. What am i doing wrong?
View 5 Replies
View Related
Jun 6, 2013
Is it possible to generate a report from 2 listboxes?
I have attached a pic of what I am trying to accomplish. I am wanting to have a report open with only the criteria that a user selects from the listboxes.
listbox 1: User selects a case number(s)
listbox 2: User selects the fields they would like in the report
So, if the user selects:
Case number: 13-001
Then selects fields:
Allegation
Incident date
Focus_Last name
This report would be:
Code:
Case Number Allegation Incident Date Focus_Last Name
13-001 DUI 06/01/2013 Doe
View 5 Replies
View Related
Dec 11, 2013
I'm looking for some sample VBA code that dynamically creates a link to Visual FoxPro 9 table. Our group has a number of end user FoxPro applications, and as FoxPro is reaching the end of its life in January 2015, we need to replace it.
A lot of the processing we do uses tables with a date embedded in the name, e.g. MyData_20131211.dbf. We'd like to be able to let our users to use Access queries that point to these tables without having to manually create the ODBC link each day. Is there a way to set up a link once, then use VBA code to dynamically change the table it points to?
For example, we set up an ODBC link table to MyData_20131211.dbf, and rename the link table in Access to MyData_Today. Then tomorrow, the VBA code would change the link to point to MyData_20131212.dbf.
An alternative would be to dynamically recreate the link each day.
As the tables are large, we don't want to import them into Access if we don't have to.
View 3 Replies
View Related
Jun 25, 2014
I am trying to build a function that will create a dynamic query for a chart on a Subreport.I am not exactly sure I am going about this the right way, but I need the user to be able to change selected fields for use in the query. I have a form with 3 combobox controls for selecting options to change the SQL statement. So far my code only deals with one of these comboboxes for simplicity. There is a button to call my function. Currently, the function is setting hidden text box values based on the combo controls, but I'm not sure if this is redundant.
I am using this as my guide for building the sql, but I am having trouble picking up the values in my text boxes for use in the SQL. [URL] .....
Code:
Option Compare Database
Option Explicit
[code]...
how do I get a value from an unbound textbox on an unbound form into a string to use as sql? The value in the textbox is a number.
View 3 Replies
View Related