Solved

Storing number in field

Posted on 2014-01-28
8
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

636 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