?
Solved

Formula in Access

Posted on 2014-01-29
7
Medium Priority
?
237 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

801 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