A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need help changing a result in a Text Box!



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2005, 11:18 PM
Bob
external usenet poster
 
Posts: n/a
Default 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  
Old April 30th, 2005, 12:12 AM
Randy Harris
external usenet poster
 
Posts: n/a
Default

"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  
Old April 30th, 2005, 01:13 AM
Bob
external usenet poster
 
Posts: n/a
Default

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  
Old April 30th, 2005, 03:52 AM
Randy Harris
external usenet poster
 
Posts: n/a
Default

"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  
Old April 30th, 2005, 04:00 AM
Bob
external usenet poster
 
Posts: n/a
Default

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  
Old April 30th, 2005, 04:06 AM
Bob
external usenet poster
 
Posts: n/a
Default

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  
Old April 30th, 2005, 06:40 AM
Randy Harris
external usenet poster
 
Posts: n/a
Default

"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  
Old April 30th, 2005, 06:56 AM
Bob
external usenet poster
 
Posts: n/a
Default

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  
Old April 30th, 2005, 04:16 PM
Randy Harris
external usenet poster
 
Posts: n/a
Default

"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  
Old April 30th, 2005, 10:11 PM
Bob
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 04:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.