473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trouble Applying VB Code in Report!!!!!

Hi All,

I have Created a tax table in vb code and am trying to apply it to the load function of my report. However on open it only applies to the first line and repeats the result. I want it to apply it to all results and give me unique answers. I have no idea and am competly stuck all help would be greatly appreciated!!!

Here Is my Code:
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Report_Load()
  2.  
  3.     Select Case Me.TaxFreeThreshold
  4.  
  5.     Case True
  6.  
  7.         If (Me.SumOfEmployeeGross / 2) <= 198 Then
  8.         Me.EmployeeTax = 0
  9.  
  10.         ElseIf (Me.SumOfEmployeeGross / 2) <= 342 Then
  11.         Me.EmployeeTax = ((0.15 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 29.7115) * 2
  12.  
  13.         ElseIf (Me.SumOfEmployeeGross / 2) <= 402 Then
  14.         Me.EmployeeTax = ((0.25 * (((Me.SumOfEmployeeGross) / 2) + 0.99)) - 63.9308) * 2
  15.  
  16.         ElseIf (Me.SumOfEmployeeGross / 2) <= 576 Then
  17.         Me.EmployeeTax = ((0.165 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 29.7117) * 2
  18.  
  19.         ElseIf (Me.SumOfEmployeeGross / 2) <= 673 Then
  20.         Me.EmployeeTax = ((0.185 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 41.2502) * 2
  21.  
  22.         ElseIf (Me.SumOfEmployeeGross / 2) <= 1225 Then
  23.         Me.EmployeeTax = ((0.335 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 142.2117) * 2
  24.  
  25.         ElseIf (Me.SumOfEmployeeGross / 2) <= 1538 Then
  26.         Me.EmployeeTax = ((0.315 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 117.6925) * 2
  27.  
  28.         End If
  29.  
  30.     Case False
  31.  
  32.         If (Me.SumOfEmployeeGross / 2) <= 259 Then
  33.         Me.EmployeeTax = ((0.165 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 0.165) * 2
  34.  
  35.         ElseIf (Me.SumOfEmployeeGross / 2) <= 355 Then
  36.         Me.EmployeeTax = ((0.2346 * (((Me.SumOfEmployeeGross) / 2) + 0.99)) - 18.0692) * 2
  37.  
  38.         ElseIf (Me.SumOfEmployeeGross / 2) <= 908 Then
  39.         Me.EmployeeTax = ((0.335 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 53.7885) * 2
  40.  
  41.         ElseIf (Me.SumOfEmployeeGross / 2) <= 1221 Then
  42.         Me.EmployeeTax = ((0.315 * ((Me.SumOfEmployeeGross / 2) + 0.99)) - 35.6154) * 2
  43.  
  44.         End If
  45.  
  46.     End Select
  47.  
  48. Me.EmployeeNet = SumOfEmployeeGross - EmployeeTax
  49.  
  50. End Sub 
Nov 1 '10 #1
1 1058
TheSmileyCoder
2,322 Expert Mod 2GB
The reports Load event only runs once (when the report loads....)

If you want to use it as each detail (each record) is formatted, you need to use the Detail_Format() event.

Another option would be to write it in a function, and call the function in the query behind the report.
Nov 2 '10 #2

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

Similar topics

2
by: Charley | last post by:
I've got a diff file that I think is a patch for a bunch of file in a directory. How do I apply this file? I thought it was #patch myfile.diff But that does nothing. I must be missing...
4
by: zmcelrath87 | last post by:
I am having a problem involving the scope of timeouts and intervals. Since timeouts and intervals execute in the global scope, dynamically generated local interval/timeout declarations do not work,...
2
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
4
by: MS | last post by:
I'm having trouble applying a filter to a subform. I create a String in a Module based on various selections on the form. Clicking a button on the "stand alone form" that changes the filter...
2
by: isaac rainsford | last post by:
i have some code that works fine in vb6, but when i paste it into vb.net 2003, i get errors thrown... can anyone tell me a good port of call for help converting this code??? i am assuming thing...
2
by: mikepolitowski | last post by:
Hi folks, I am have been trying to solve this problem for quite some time now and would appreciate any advice. I have been trying to call a code-behind function that is defined in my aspx.cs...
1
by: dontbe | last post by:
Hi Guys, I'm newbie in this forum,.. and i'm having trouble with Data Report. I've been read about How to Create Dynamic Report (thanks to Creative1). But now i have some other trouble (sorry...
1
by: Saberthedream | last post by:
Hello, I am creating a crystal report in .net and i need to print the crystal report directly without showing it to user . for this i am writing code Report.PrintToPrinter(1, true, 0, 0); but...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.