473,382 Members | 1,409 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,382 software developers and data experts.

Calculation of invoice Fees - Special Cases

77 64KB
Hi twinnyfo, thanks for the code. I am calculating the admin fees on the form. Can you help me with the code for the special cases?


[z{this thread was split from: Calculation Invoice Fees
Oct 7 '14 #1

✓ answered by twinnyfo

Didn't we have a field in the Countries Table (or elsewhere) that indicated whether a particular country charged an admin fee?

If this is the case (see our previous thread), when we calculate the fees:

Expand|Select|Wrap|Line Numbers
  1. Me.txtAdminFee = _
  2.     Format( _
  3.         IIf(Me.chkAdminFeeInitial, _
  4.             Me.txtInitialPremium * 0.015, _
  5.             0 )
  6.             ), _
  7.         "Currency" _
  8.         )
Line 1: This is the text box where we want the admin fee to show up.

Lines 2, 7: You said you wanted it to appear as currency, so we use the Format() Function

Line 3: We check to see if this record has an Admin Fee (brought in from the Countries Table).

Line 4: If it does require an admin fee, then we calculate.

Line 5: If not, then the Admin Fee is 0.

5 1152
twinnyfo
3,653 Expert Mod 2GB
wirejp,

As we discussed before, in order to calculate the special cases, we need:
  1. To know the exact criteria for those special cases
  2. To know how to identify those special cases programmatically

Item one is where we start. Then we build the code around those conditions.
Oct 8 '14 #2
wirejp
77 64KB
I was trying to following VBA code to correct the Initial Fee Invoice for a special case, but there was no change in the Initial Fee Invoice amount when viewed in the Form view. I was thinking If I select the country and apply the correct formula, then the should update correctly.

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtInitialFeeInvoice_AfterUpdate()
  2.    Dim txtInitialFeeInvoice As Double
  3.    Dim txtInitialPremium As Double
  4. '
  5.    dblInitialFeeInvoice = _
  6.       IIf(cbo.Country = "Country A", _
  7.         dblInitialPremium * _
  8.          Me.chkAdminFeeInitial * 0.015, _
  9.          "$0.00")
  10. '               
  11. End Sub
Oct 8 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Didn't we have a field in the Countries Table (or elsewhere) that indicated whether a particular country charged an admin fee?

If this is the case (see our previous thread), when we calculate the fees:

Expand|Select|Wrap|Line Numbers
  1. Me.txtAdminFee = _
  2.     Format( _
  3.         IIf(Me.chkAdminFeeInitial, _
  4.             Me.txtInitialPremium * 0.015, _
  5.             0 )
  6.             ), _
  7.         "Currency" _
  8.         )
Line 1: This is the text box where we want the admin fee to show up.

Lines 2, 7: You said you wanted it to appear as currency, so we use the Format() Function

Line 3: We check to see if this record has an Admin Fee (brought in from the Countries Table).

Line 4: If it does require an admin fee, then we calculate.

Line 5: If not, then the Admin Fee is 0.
Oct 8 '14 #4
zmbd
5,501 Expert Mod 4TB
wirejp
Do you have Option Explicit at the top of your modules? If not you should as explained in the troubleshooting section: > Before Posting (VBA or SQL) Code

Neither dblInitialFeeInvoice nor dblInitialPremium appear to be defined in your code. If these are global then of course that's not an issue. If these refer to something on your form or within the recordset then you need to establish that relationship.

I'm fairly certain that if you have Option Explicit at the top of your module that if you attempted a debug/compile that you would get an error on those two variables.
Oct 8 '14 #5
wirejp
77 64KB
Hi Twinnyfo,

Thank you for the explanation. I was able to fixed that problem.

Hi zmbd,
The Option Explicit was not checked at the top of the module. So it had picked up an error when I compiled.
Oct 10 '14 #6

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

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
3
by: NoEd | last post by:
I was talking to a couple guys at one of the hospitals I consult with, and they indicated their 401K is charging them $8 per quarter and .0875% based on the value in their accounts at the end of...
9
by: MX1 | last post by:
Hi, I've got an invoice form that has a bunch of business rules behind it. Basically, I'm trying to figure out how to enter a single number in a field (e.g. $1000) and then have the form do a...
0
by: Guoqi Zheng | last post by:
Dear sir, I am develoing an application on ASP.NET. This application needs to print a few hundreds invoice everyday. Those invoice has to be printed on a very very precise position on a special...
12
by: Raymond Hettinger | last post by:
I am evaluating a request for an alternate version of itertools.izip() that has a None fill-in feature like the built-in map function: >>> map(None, 'abc', '12345') # demonstrate map's None...
4
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The...
7
by: Ben Finney | last post by:
Howdy all, Ned Batchelder blogged about a debate over checking function parameters, and to what extent dynamic typing should be relied upon. I was one of many who commented, but I wrote what...
4
by: gregincolumbus | last post by:
I am trying to get the financial calculation on this to trigger whenever there is a change to select1. Right now, the user has to click on select2 to trigger the changes. Ideally, a change of...
5
by: Bigdaddrock | last post by:
I have two entries on an Invoice form: PRICE and QUANTITY (as well as the INVOICE NUMBER). In creating a new INVOICE I am pulling in a product's PRICE from a table (though the price may change...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.