473,382 Members | 1,390 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.

Every time that i try to add the quantity to the stock a problem occurred

115 100+
hi i'm working on these tables

database (for shoes)
---------
item_size(Article,size,stock,quantity)
item(Article,stock,price,st_q1,st_q2,st_q3,...,st_ q10, code_supplier)
Order(order_num,order_date,pers_code)
Order_detail(order_num,order_date,code_pers,articl e)
--------------
i did a form to enter the quantity to stock
that form contain order.order_num, order.order_date, order.pers_code, and a subform that contains:
order_detail.order_num, order_detail.order_date, order_detail.code_pers, order_detail.article, order_detail.quantity, order_detail.purchase_price, order_detail.q1, order_detail.q2,..., order_detail.q10, order_detail.SaleOrReturn item.stock, item.st_q1, item.st_q2,..., item.st_q10.
----------------
on the after update of the quantity i wrote this :
Expand|Select|Wrap|Line Numbers
  1. Private Sub quantity_AfterUpdate()
  2. If Me.SaleOrReturn.Value = 1 Then   
  3. 'that means that i'm buying from the supplier
  4. Me.stock.Value = (Nz(Me.stock.Value, 0) - Me.quantity.OldValue)
  5. DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
  6. Me.stock.Value = (Nz(Me.stock.Value, 0) + Me.quantity.Value)
  7. Else ' Here i'm returning articles to the supplier
  8. Me.stock.Value = (Nz(Me.stock.Value, 0) + Me.quantity.OldValue)
  9. DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
  10. Me.stock.Value = (Nz(Me.stock.Value, 0) - Me.quantity.Value)
  11. End If
  12. End Sub
----------------------
When the form load i can see the value of the stock for example 49 for the article1, but when i insert the value of the quantity for example (quantity=1) the value of the stock change also to 1 !! (But the true value should be 50 = 49+1)
and when i delete the record the field stock in the table item is updated to 0 !!
Any one can help please!! ??

--------------
I had also tried this code:
Expand|Select|Wrap|Line Numbers
  1. Me.stock.Value = (Me.stock.Value - Me.quantity.OldValue)
  2. DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
  3. Me.stock.Value = (Me.stock.Value + Me.quantity.Value)
  4. Else
  5. Me.stock.Value = (Me.stock.Value + Me.quantity.OldValue)
  6. DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
  7. Me.stock.Value = (Me.stock.Value - Me.quantity.Value)
  8.  
On load the stock is 49 after i add a 1 to the quantity, the stock field became null!!
-----------------
I now it's a long question but hope someone will help . Thanks! :)
Aug 4 '10 #1
0 1226

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

Similar topics

3
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have...
0
by: Richard | last post by:
All, There is a KB article pertaining to windows installer running every time an application starts - so I know it's an issue - but the KB article pertains to MS Office only. I am seeing the...
1
by: Fabricio Tofoli | last post by:
Hello all, I have a simple ASP.NET project that displays the contents of a MySql database table in the web page. All pages are extremelly slow, and not only the first time you access them, it's...
2
by: Fredrik G | last post by:
Whenever i hit F5, my project builds, but then i get an error "The operation could not be completed" Then i have to launch task manager, and end the "myproject.vshost.exe" process manually. Now,...
0
by: Rolf Barbakken | last post by:
I have a most annoying problem: I have a gridview with users from AD. When the user clicks on the header row a postback is triggered, and the _Sorting-event fires. This is fine, and my...
4
by: vunet.us | last post by:
Hi, I found a bug in IE6, though it is known already. If I have a CSS background property set to some image, such as background:url(myimg.gif);, and I apply this property to some html element,...
0
by: Rachana | last post by:
RecordSelectionFormula doesn't return correct records. every time Hi! I am working in VB6-CR8.5 Either I use RecordSelectionFormula or SqlQueryString, getting the same problem: My...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
26
by: Ravindra.B | last post by:
I have declared a global variable which is array of pointers and allocated memory for each array variable by using malloc. Some thing similar to below... static char *arr; main() { int i;
9
by: Joergen Bech | last post by:
I have an app that needs to run with elevated privileges on Windows Vista (Registry operations - don't ask). I have added a manifest file that looks like this: ---snip--- <?xml version="1.0"...
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?
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...

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.