Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking up Values

Status
Not open for further replies.

Ianpen

Technical User
Jul 1, 2003
45
0
0
GB
Hi Guys and Dolls

I have a database where I want to take a total order count for the day and take that total and make the follow calculation on it :- If the total orders for the day is 1, 2, or 3 the Value is £2.00 if the Value is 4, 5, or 6 the Value is £4.00 and so on until 300. I then want to add up the monatry values for each day and print off a monthly invoice.

Is there an easy way to do this or am I going to have to use VB (eek).

Any help would be appreciated.

Thanks
Ian
 
Use a table then query off that

value return
1 £2.00
2 £2.00
3 £2.00
4 £4.00
....
 
or, maybe calculate direct in a query by using a formula like:
value: 1/3*totalorders*2 (not as accurate, but you can use f.i. something like rounding up to whole numbers)


Pampers.

You're never too young to learn
 
or perhaps a function:
Code:
[blue]Public Function OrderVal(Orders As Integer)
   Dim x As Integer
   
   For x = 3 To 300 Step 3
       If Orders <= x Then
         OrderVal = (x * 2) / 3
         Exit For
      End If
   Next

End Function[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks Guys

Plenty for me to think about there, I will try some now and see which suits best. I will let you know how I get on.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top