Solved

Formula in Access

Posted on 2014-01-29
7
227 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now