If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need help changing a result in a Text Box!
-- After searching Google.groups.com and finding no answer, Bob Vance asked: I have three boxes on a form (a) Shows a percentage e.g. 12.5% (tbRate) (b) Enter a figure 1000.00 (tbWithOutGST) (c) Shows result a*b 1250.00(tbWithGST) But want the result to be (a minus b) result to be 888.89 So Basically i want it in reverse enter with GST and get result minus GST How would I go about changing this, Please Thanks in advance.........Bob Vance |
#2
|
|||
|
|||
"Bob" wrote in message ...
-- After searching Google.groups.com and finding no answer, Bob Vance asked: I have three boxes on a form (a) Shows a percentage e.g. 12.5% (tbRate) (b) Enter a figure 1000.00 (tbWithOutGST) (c) Shows result a*b 1250.00(tbWithGST) But want the result to be (a minus b) result to be 888.89 So Basically i want it in reverse enter with GST and get result minus GST How would I go about changing this, Please Thanks in advance.........Bob Vance This formula will do that calculation: c = b / (1 + (a / 100)) or it can be rewritten: c = b * 100 / (100 + a) HTH, Randy |
#3
|
|||
|
|||
Where would I find the formula to change it, Thanks
"Randy Harris" wrote in message ... "Bob" wrote in message ... -- After searching Google.groups.com and finding no answer, Bob Vance asked: I have three boxes on a form (a) Shows a percentage e.g. 12.5% (tbRate) (b) Enter a figure 1000.00 (tbWithOutGST) (c) Shows result a*b 1250.00(tbWithGST) But want the result to be (a minus b) result to be 888.89 So Basically i want it in reverse enter with GST and get result minus GST How would I go about changing this, Please Thanks in advance.........Bob Vance This formula will do that calculation: c = b / (1 + (a / 100)) or it can be rewritten: c = b * 100 / (100 + a) HTH, Randy |
#4
|
|||
|
|||
"Bob" wrote in message ...
Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#5
|
|||
|
|||
Found it how would I change it. Thanks Bob
"Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#6
|
|||
|
|||
Sorry here it is:
Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub "Bob" wrote in message ... Found it how would I change it. Thanks Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#7
|
|||
|
|||
"Bob" wrote in message ...
Sorry here it is: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub Bob, it's getting its data from that function (funCalGST). Do a search for that, then post the function. Randy "Bob" wrote in message ... Found it how would I change it. Thanks Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#8
|
|||
|
|||
Found it but it is being used for something else:
Can a new script be written? Function funCalGST() As Currency Dim sngGstPercentage As Single, recGSTOptions As ADODB.Recordset Set recGSTOptions = New ADODB.Recordset recGSTOptions.Open "SELECT * FROM tblGSTOptions WHERE GSTOptionsText LIKE '" _ & cbGSTOptions.value & "'", cnnStableAccount, adOpenDynamic, adLockOptimistic If recGSTOptions.EOF = True And recGSTOptions.BOF = True Then MsgBox "Invalid GSTOption.", vbApplicationModal + vbInformation + vbOKOnly 'Exit Sub End If sngGstPercentage = CSng(Nz(recGSTOptions.Fields("GSTPercentage"), 0)) tbRate.value = sngGstPercentage * 100 funCalGST = (Nz(tbWithoutGST.value, 0) * Nz(tbRate.value, 0) / 100) + Nz(tbWithoutGST.value, 0) End Function "Randy Harris" wrote in message ... "Bob" wrote in message ... Sorry here it is: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub Bob, it's getting its data from that function (funCalGST). Do a search for that, then post the function. Randy "Bob" wrote in message ... Found it how would I change it. Thanks Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#9
|
|||
|
|||
"Bob" wrote in message ...
Found it but it is being used for something else: Can a new script be written? Function funCalGST() As Currency Dim sngGstPercentage As Single, recGSTOptions As ADODB.Recordset Set recGSTOptions = New ADODB.Recordset recGSTOptions.Open "SELECT * FROM tblGSTOptions WHERE GSTOptionsText LIKE '" _ & cbGSTOptions.value & "'", cnnStableAccount, adOpenDynamic, adLockOptimistic If recGSTOptions.EOF = True And recGSTOptions.BOF = True Then MsgBox "Invalid GSTOption.", vbApplicationModal + vbInformation + vbOKOnly 'Exit Sub End If sngGstPercentage = CSng(Nz(recGSTOptions.Fields("GSTPercentage"), 0)) tbRate.value = sngGstPercentage * 100 funCalGST = (Nz(tbWithoutGST.value, 0) * Nz(tbRate.value, 0) / 100) + Nz(tbWithoutGST.value, 0) End Function This function is designed to get the GST percent rate from a table, rather than the text box control - tbRate. It has some serious problems, however. Rather than risk using an obviously defective function, or attempting to fix it, let's simply go back to the After update event and enter the proper calculation there. Change this: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub To: Private Sub tbWithoutGST_AfterUpdate() Me.tbWithGST = Me.tbWithOutGST / (1 + (Me.tbRate / 100)) End Sub See if that doesn't get you the result that you want. BTW - assuming this gets you the desired result, you might want to put the identical same calculation in the AfterUpdate event for tbRate. That way, if someone enters a value in tbWithoutGST before entering a GST rate, the calculation will still be done. Randy "Randy Harris" wrote in message ... "Bob" wrote in message ... Sorry here it is: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub Bob, it's getting its data from that function (funCalGST). Do a search for that, then post the function. Randy "Bob" wrote in message ... Found it how would I change it. Thanks Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
#10
|
|||
|
|||
Randy that worked fine but, If I change the tax rate on front form 12.5 to
10 the text box next to withgst and withoutgst dose not alter so i can not get a 10% caluclation, Regards Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Found it but it is being used for something else: Can a new script be written? Function funCalGST() As Currency Dim sngGstPercentage As Single, recGSTOptions As ADODB.Recordset Set recGSTOptions = New ADODB.Recordset recGSTOptions.Open "SELECT * FROM tblGSTOptions WHERE GSTOptionsText LIKE '" _ & cbGSTOptions.value & "'", cnnStableAccount, adOpenDynamic, adLockOptimistic If recGSTOptions.EOF = True And recGSTOptions.BOF = True Then MsgBox "Invalid GSTOption.", vbApplicationModal + vbInformation + vbOKOnly 'Exit Sub End If sngGstPercentage = CSng(Nz(recGSTOptions.Fields("GSTPercentage"), 0)) tbRate.value = sngGstPercentage * 100 funCalGST = (Nz(tbWithoutGST.value, 0) * Nz(tbRate.value, 0) / 100) + Nz(tbWithoutGST.value, 0) End Function This function is designed to get the GST percent rate from a table, rather than the text box control - tbRate. It has some serious problems, however. Rather than risk using an obviously defective function, or attempting to fix it, let's simply go back to the After update event and enter the proper calculation there. Change this: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub To: Private Sub tbWithoutGST_AfterUpdate() Me.tbWithGST = Me.tbWithOutGST / (1 + (Me.tbRate / 100)) End Sub See if that doesn't get you the result that you want. BTW - assuming this gets you the desired result, you might want to put the identical same calculation in the AfterUpdate event for tbRate. That way, if someone enters a value in tbWithoutGST before entering a GST rate, the calculation will still be done. Randy "Randy Harris" wrote in message ... "Bob" wrote in message ... Sorry here it is: Private Sub tbWithoutGST_AfterUpdate() tbWithGST.value = funCalGST End Sub Bob, it's getting its data from that function (funCalGST). Do a search for that, then post the function. Randy "Bob" wrote in message ... Found it how would I change it. Thanks Bob "Randy Harris" wrote in message ... "Bob" wrote in message ... Where would I find the formula to change it, Thanks It could be in a number of different places. Perhaps the most likely is in the code behind that form. Check the AfterUpdate event for tbWithOutGST. You might get a clue by watching the form to see what specific event causes a value to appear in tbWithGST. |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Linking text boxes | Volunteer Mom | Publisher | 7 | November 12th, 2008 01:29 AM |
Need Subforms? | AccessRookie | Using Forms | 7 | April 8th, 2005 09:30 AM |
Outline | Renee Hendershott | Page Layout | 2 | December 25th, 2004 02:49 PM |
How does the "auto" setting work in Paragraph Spacing? | Joey | General Discussion | 9 | October 11th, 2004 08:44 PM |
Readding Numerical value to ext | Hoang Han | Worksheet Functions | 2 | December 4th, 2003 05:37 PM |