[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Formula in Access

Posted on 2014-01-29
7
Medium Priority
?
239 Views
Last Modified: 2014-01-29
I am using the below code. It works perfect until I use really big numbers. When I use numbers 14 or 15 digits long, it comes up an error. Anything I can do so it supports really large numbers?

Private Sub Check18_Click()

If Me.Check18 = -1 Then
Me.SavedNumber = Me.rawnumber * 1.75

Me.rawnumber = ""

End If

End Sub
0
Comment
Question by:cansevin
  • 3
  • 2
  • 2
7 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39818068
Me.rawnumber may have a datatype of "Integer" or "Long"...you may need to change this so that it can handle larger numbers such as what you've been giving it.  I suggest using "double."

Look at this page: http://www.seattlecentral.edu/~cstanford/itc220/datatypes.pdf
or
http://www.w3schools.com/sql/sql_datatypes.asp
0
 

Author Comment

by:cansevin
ID: 39818079
Is that something I change on the form or on the table? That field isn't hooked up to a table... so I hope I can change it on the form.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39818091
Are you getting a VBA error?  (Which one?)

Or is the form displaying #Error?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39818094
There is likely a simple "Dim rawnumber" statement in the form's code.  It declares that variable (just do a find...Ctrl + F to find it).  On that line of code you'll see explicitly what the datatype is.
0
 

Author Comment

by:cansevin
ID: 39818101
Yes... VBA error.

"The value your entered isn't valid for this field".
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39818108
Btw, sl8rz is correct about needing a datatype that can handle large numbers, but it should be the SavedNumber field that is formatted as Double, Single or anything other than integer/long int in your table's design.

RawNumber, since it is an unbound textbox can handle (almost) anything you place in it.

Take a look at the Supported Field Properties here:
http://office.microsoft.com/en-us/access-help/introduction-to-data-types-and-field-properties-HA010341783.aspx
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39818116
(This is in the 'Field Properties' section shown in the bottom part of your table design window)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question