Calculations in querry

G

Guest

Hola,

I have the next problem.

In one table I have a productname and the number of cartons that fit on a
pallet
Products.ProductID and Products.CartonsPerPallet

For example
ProductID CartonsPerPallet
12345 20


In another table I have a shipping order with a number of requested cartons.
ShippingOrder.line, ShippingOrder.ProductID, ShippingOrder.Cartons

Line productID Cartons
1 1234 44


Now I want in another table the number of full pallets, which should be 2
....rounddown(44/20)... and the number of loose cartons ...44%20...

Can I put this in one querry,

Thanks,
 
J

Jeff Boyce

Nasko

Take a look at Access HELP on the "integer divide" and "mod" functions. I
suspect your query will have two additional fields, something like:

FullPallets: [Cartons]\[Cartons per Pallet]

LooseCartons: [Cartons] Mod [Cartons per Pallet]

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
S

Steve

DO NOT put the number of full pallets and/or the number of loose cartons in
a table. That is incorrect database design. You can get both of these when
needed at run time.

number of full pallets = Int(Cartons/CartonsPerPallet)

Loose cartons = Cartons MOD CartonsPerPallet

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top