Solved

Storing number in field

Posted on 2014-01-28
8
336 Views
Last Modified: 2014-01-29
I have a check mark on a form. Every time the check mark is checked, I would like the value in the field titled: "rawnumber" to be multiplied by 2.25 and stored in the field titled "SavedNumber". Once after the proper number is stored I want it to clear what was in the "RawNumber".

Note the field where the number is entered is an unbound field. Not sure if that matters. I am guessing I do an "After Update" event for the check mark?
0
Comment
Question by:cansevin
  • 4
  • 4
8 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39815929
use the click event of the checkbox.

you can do the multiplication every click ( check or uncheck) or only if the checkbox is check.
0
 

Author Comment

by:cansevin
ID: 39815932
What would the code look like?
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39815950
private sub chekbox_click()
dim varNumber
varNumber=nz(me.SavedNumber,0)
if varnumber>=<some value> then
me.SavedNumber=varnumber
exit sub
else
      varnumber= varnumber + me.rawnumber * 2.25
      me.savenumber=varnumber
end if

end sub


some what like that, give more details
0
 

Author Comment

by:cansevin
ID: 39817830
Rey... thanks for your help on this! Trying to finish it this morning.

I used your code... there seems to be a problem with the line:

"if varnumber>=<some value> then"

It is highlighted Red when I put it in. Also, When I click the check box, it takes me to the code with that line highlighted.

Any ideas? Thanks again!
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39817863
you have to replace "<some value>"  with a number, according to what you stated above

Once after the proper number is stored I want it to clear what was in the


is that a max limit or what?
0
 

Author Comment

by:cansevin
ID: 39817906
Not sure I explained myself properly... when the check box is clicked. It will muliply what is in RawNumber by 2.25 and store the result in SavedNumber. Then it will erase what was entered in RawNumber.

Does that clarify?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39817928
private sub checkBoxName_Click()

if me.checkboxName=-1 then
me.savednumber=me.rawnumber * 2.25

me.rawnumber=""

end if

end sub
0
 

Author Closing Comment

by:cansevin
ID: 39817957
Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 …

746 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

12 Experts available now in Live!

Get 1:1 Help Now