Solved

Formula in Access

Posted on 2014-01-29
7
226 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

707 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

14 Experts available now in Live!

Get 1:1 Help Now