By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,222 Members | 1,610 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,222 IT Pros & Developers. It's quick & easy.

Check box help

P: 51
Could someone help me with the code for a calculation
When I click on a check box I want to be able to insert a answer for state sales tax in a text box (txtSt1)

Check Box = (ckst1)
Text Box to calculate sales tax = (txtSt1) Pa state sales tax (.06)
Text Box that has total to be calculated = (txtTotalCost1)

NOTE: don't know if this makes a difference but (txttotalcost1) is a unbound calcuation not a bound source

Jul 12 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 8,679
In the AfterUpdate() Event of your Check Box:
Expand|Select|Wrap|Line Numbers
  1. Private Sub ckst1_AfterUpdate()
  2. Dim txtTC As TextBox
  4. Set txtTC = Me![txtTotalCost1]
  6. 'If the Check Box is Checked, and txtTotalCost contains a Value'
  7. 'And the Value in txtTotalCost is a Number, then proceed
  8. If Me![ckst1] And Not IsNull(txtTC) And IsNumeric(txtTC) Then
  9.   Me![txtSt1] = FormatNumber((txtTC * 0.06), 2)
  10. End If
  11. End Sub
Jul 12 '09 #2

P: 51
thank you very much - worked like a champ!

i should of posted what i was using - would of won the most embarrassing code award. - although could of given you a chuckle. (smile)

thanks again
Jul 12 '09 #3

Expert 5K+
P: 8,679
Always glad to help out, Gary.
Jul 12 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.