Solved

Storing number in field

Posted on 2014-01-28
8
339 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

828 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