Formula in Access

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
Who is Participating?

Improve company productivity with a Business Account.Sign Up

mbizupConnect With a Mentor Commented:
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:
David L. HansenProgrammer AnalystCommented:
Me.rawnumber may have a datatype of "Integer" or "Long" 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:
cansevinAuthor Commented:
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.
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Are you getting a VBA error?  (Which one?)

Or is the form displaying #Error?
David L. HansenProgrammer AnalystCommented:
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.
cansevinAuthor Commented:
Yes... VBA error.

"The value your entered isn't valid for this field".
(This is in the 'Field Properties' section shown in the bottom part of your table design window)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.