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

Complicated problem

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
1 1374
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bo Peng | last post by:
Dear Python group: I am planning on an application that involves several complicated C++ classes. Basically, there will be one or two big data objects and some "action" objects that can act on...
15
by: Agoston Bejo | last post by:
Hi, I'm having trouble with implementing some constraints on the database level. An example: --Table A(AID, BID ref. B.BID, ATXT) --Table B(BID, CID ref. C.CID) --Table C(CID) upon insertion...
4
by: Ulrich Albrecht | last post by:
Hi, I'm making a complicated css based site (CMS) without tables (because of Accessibility). It looks good in any new browsers on my machine (IE5.5, IE6, NS7, OP6, Mozilla 1.1) :-) You can...
4
by: Tom Schmitt | last post by:
I tried getting a complicated, multi-column box design on it's way on my web-site and it works out fine on the IE6. Because I'm a relative beginner to all stuff related to CSS and am used to...
26
by: Jeff | last post by:
Ok gang. Here is something complicated, well, at least to me anyway. Using Access DB I have a table in my DB called members. In that table, I have 2 tables I will be using "username" and...
3
by: Henrry Pires | last post by:
Hello to all. I have and strange and complicated problem. My asp.net application raise errors when the data that the user input is invalid. For example: The user didn't fill all some data...
3
by: Charlie Bear | last post by:
i've got myself into a bit of an oo mess. it's probably me misunderstanding how oo works. I've got a base class called "Feature" which some classes inherit. in the database i've stored the data...
11
by: CoreyWhite | last post by:
So I'm reading books about perl, which may not be quite as powerful as C++ but at least has more power than C & is very easy to learn from the manuals. I'm also buying books on C++, and books...
4
by: Horacius ReX | last post by:
Hi, I have to read some data from a file, and on each block it always appears the followng string; xyz.vs.1-81_1 . It appears a lot of time with different numbers like; xyz.vs.1-81_1...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.