By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

Complicated problem

P: n/a
I have a very complicated problem.I have a function that checks
whether the cartons in the warehouse,which are branch0, are greater
than the cartons ordered. Which means that
If branch < cartons then
exit function

The function works great if the cartons are not opened.But when one
carton is opened, and one piece from the carton is sold, then the
number of the cartons in the warehouse is with 1 less, since one
carton
is opened.The fault in my function is that it allows to order a non
existing carton.
For example
If one cartons contains 24 pieces then it is o.k. The pieces are
obtained by
multiplying cartons*pack = pieces.
If however we have sold one piece, then the carton will not be
full,but the function
does not recognize it.
The part of the function that works in this way is the folowing:

If CLng(DLookup("branch", "Products", strCondition)) < CLng(cartons)
Then
MsgBox "There isn't enough stock to fill this order.", vbInformation +
vbOKOnly
DoCmd.GoToControl "productid"
Exit Function
End If
Else
..................

In order to solve my problem, I have tried to enter a new variable
TrueCartons,by multiplying the cartons with the pack and dividing to
the pack. And then,if the true cartons are less than the real cartons,
the Exit Function.

TrueCartons = (CLng(DLookup("branch0", "Products", strCondition)) *
CLng(pack)) / [pack]

If TrueCartons < CLng(DLookup("branch0", "Products", strCondition))
Then

MsgBox "There isn't enough stock to fill this order.", vbInformation +
vbOKOnly
Exit function

To my regret nothing happens and no message appears.
Where the fault may lie ?
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On a stock system you normally have (at least) 3 different units for a
product, these are:-
Buying Unit
Stocking Unit
Selling Unit

In your particular case I suspect the Buying Unit and the Stocking Unit are
cartons while the Selling Unit is piece.

Therefore when you sell you need to convert from your stocking unit to your
selling unit.

As your selling unit is smaller than your stocking unit you will have to
have some way of indicating that you have a part of a stocking unit. in
your particular case it would probably be easiest to change your stocking
unit to pieces as well. If the business you are in is used to seeing a
stocking unit of cartons you can always convert for the purpose of reports.

Essentially, if you can sell pieces then you should be checking pieces not
cartons.

Terry
"Johm" <ke**@abv.bg> wrote in message
news:24**************************@posting.google.c om...
I have a very complicated problem.I have a function that checks
whether the cartons in the warehouse,which are branch0, are greater
than the cartons ordered. Which means that
If branch < cartons then
exit function

The function works great if the cartons are not opened.But when one
carton is opened, and one piece from the carton is sold, then the
number of the cartons in the warehouse is with 1 less, since one
carton
is opened.The fault in my function is that it allows to order a non
existing carton.
For example
If one cartons contains 24 pieces then it is o.k. The pieces are
obtained by
multiplying cartons*pack = pieces.
If however we have sold one piece, then the carton will not be
full,but the function
does not recognize it.
The part of the function that works in this way is the folowing:

If CLng(DLookup("branch", "Products", strCondition)) < CLng(cartons)
Then
MsgBox "There isn't enough stock to fill this order.", vbInformation +
vbOKOnly
DoCmd.GoToControl "productid"
Exit Function
End If
Else
.................

In order to solve my problem, I have tried to enter a new variable
TrueCartons,by multiplying the cartons with the pack and dividing to
the pack. And then,if the true cartons are less than the real cartons,
the Exit Function.

TrueCartons = (CLng(DLookup("branch0", "Products", strCondition)) *
CLng(pack)) / [pack]

If TrueCartons < CLng(DLookup("branch0", "Products", strCondition))
Then

MsgBox "There isn't enough stock to fill this order.", vbInformation +
vbOKOnly
Exit function

To my regret nothing happens and no message appears.
Where the fault may lie ?

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.