473,405 Members | 2,141 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,405 software developers and data experts.

Automated calculations in Access.

118 100+
Hey, I have a table called TblStock with 10 columns but 3 which need the focus here. These three columns are 'Stock Level', 'Re-order Level' and 'Re-order Quantity'.

The Stock level fields contain a number between 1 and ~4'000. The Re-order level feilds all contain either '1,000' or '1,500'; the Re-order Quantity fields contain the number '3,000'.

What I would like to do is make it, either automated or via a query, when the Stock Level field value falls/is below the value in the Re-Order Level field it should add the 3,000 from the Re-Order Quantity field to the Stock Level value.

So if the value of Stock level is 237 the database should detect that this is below the value of the Re-Order Level field and therefore add 3,000 to it so the Stock level is now 3,237.

Any ideas on how to do this?

Sam
May 19 '07 #1
7 2678
i have just finished working on something similar. Its a very large piece of code.

the way i worked it is to look at what is sold to customers as a PRODUCT, but what is bought in by you is STOCK.

for example

a can of coke (product) is made up of a can of coke (Stock)

a cheese sandwich (product) is made up of bread, butter and cheese (stock)


Do you have this currently?
May 19 '07 #2
helraizer1
118 100+
i have just finished working on something similar. Its a very large piece of code.

the way i worked it is to look at what is sold to customers as a PRODUCT, but what is bought in by you is STOCK.

for example

a can of coke (product) is made up of a can of coke (Stock)

a cheese sandwich (product) is made up of bread, butter and cheese (stock)


Do you have this currently?
This isn't quite like that; it is for a warehouse system so it is listing the products in stock.
The stock levels are fixed, for this particular thing to begin with. So if the stock level is below the certain value (re-order level) it is replenished with (added onto) the amount in the third column, the Re-order Quantity value.

I hope this helps?

Any ideas?

Sam
May 19 '07 #3
ADezii
8,834 Expert 8TB
Hey, I have a table called TblStock with 10 columns but 3 which need the focus here. These three columns are 'Stock Level', 'Re-order Level' and 'Re-order Quantity'.

The Stock level fields contain a number between 1 and ~4'000. The Re-order level feilds all contain either '1,000' or '1,500'; the Re-order Quantity fields contain the number '3,000'.

What I would like to do is make it, either automated or via a query, when the Stock Level field value falls/is below the value in the Re-Order Level field it should add the 3,000 from the Re-Order Quantity field to the Stock Level value.

So if the value of Stock level is 237 the database should detect that this is below the value of the Re-Order Level field and therefore add 3,000 to it so the Stock level is now 3,237.

Any ideas on how to do this?

Sam
'Execute this code wherever you like in order to replenish your Stock Level when it falls below the Re-Order Level:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. strSQL = "UPDATE tblStock SET tblStock.[Stock Level] = [Stock Level]+[Re-Order Quantity] " _
  4.           & "WHERE tblStock.[Stock Level]<[Re-Order Level];"
  5.  
  6. DoCmd.SetWarnings False
  7.   DoCmd.RunSQL strSQL
  8. DoCmd.SetWarnings True
May 19 '07 #4
helraizer1
118 100+
'Execute this code wherever you like in order to replenish your Stock Level when it falls below the Re-Order Level:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. strSQL = "UPDATE tblStock SET tblStock.[Stock Level] = [Stock Level]+[Re-Order Quantity] " _
  4.           & "WHERE tblStock.[Stock Level]<[Re-Order Level];"
  5.  
  6. DoCmd.SetWarnings False
  7.   DoCmd.RunSQL strSQL
  8. DoCmd.SetWarnings True
Cool, that worked! Thanks. =D

There are also columns with the Supplier ID and Address etc.
Is there any way that, using the similar code, if the Stock level is below the order quantity it will create (preferably) a report for that particular item? Listing the Order details, etc. Supplier details from the table.

Any ideas?

Sam
May 21 '07 #5
ADezii
8,834 Expert 8TB
Cool, that worked! Thanks. =D

There are also columns with the Supplier ID and Address etc.
Is there any way that, using the similar code, if the Stock level is below the order quantity it will create (preferably) a report for that particular item? Listing the Order details, etc. Supplier details from the table.

Any ideas?

Sam
Yes, a Report can be generated for a specific Stock Item if the Stock level is below the order quantity.
  1. Is this Report going to be generated from a Form?
  2. What Fields will the Report contain, what Tables do they reside in, and what is the Relationships between the Tables?
  3. What is the Primary Key Field on the Form?
  4. I think you get the idea by now.
May 21 '07 #6
helraizer1
118 100+
Yes, a Report can be generated for a specific Stock Item if the Stock level is below the order quantity.
  1. Is this Report going to be generated from a Form?
  2. What Fields will the Report contain, what Tables do they reside in, and what is the Relationships between the Tables?
  3. What is the Primary Key Field on the Form?
  4. I think you get the idea by now.
If the TblStock.[stock level] value is less than the value of that in the [Re-order Level] then a report should be produced containing (going by ADezii's list):
  1. Form for TblStock.
  2. From TblStock: [Stock ID], [Description], [Colour], [Size]; respectively.
    -From TblStockLevel: [Re-Order Quantity].
    -From TblStockSupplier: [Supplier ID], [Supplier Name], [Address L1], [Address L2], [Supplier Town], [Supplier County], [Supplier Post Code], [Supplier Country], [Supplier Telephone]. Respectively.
    - TblStock is joined by a foreign key (in the TblStock) to a Primary key in the Supplier table [Supplier ID]
  3. The Primary key in the form is the 'Stock ID'.

Hope that was clear and I wasn't being ignorant or anything? =)

Sam
May 21 '07 #7
ADezii
8,834 Expert 8TB
If the TblStock.[stock level] value is less than the value of that in the [Re-order Level] then a report should be produced containing (going by ADezii's list):
  1. Form for TblStock.
  2. From TblStock: [Stock ID], [Description], [Colour], [Size]; respectively.
    -From TblStockLevel: [Re-Order Quantity].
    -From TblStockSupplier: [Supplier ID], [Supplier Name], [Address L1], [Address L2], [Supplier Town], [Supplier County], [Supplier Post Code], [Supplier Country], [Supplier Telephone]. Respectively.
    - TblStock is joined by a foreign key (in the TblStock) to a Primary key in the Supplier table [Supplier ID]
  3. The Primary key in the form is the 'Stock ID'.

Hope that was clear and I wasn't being ignorant or anything? =)

Sam
  1. I do not see the [Stock Level] Field anywhere, but I'll assume it is on the Form.
  2. Create a Command Button on the Form and call it cmdReorderReport.
  3. In the Current() Event of your Form, place the following code:
    Expand|Select|Wrap|Line Numbers
    1. If Me![Stock Level] < Me![Re-Order Quantity] Then
    2.   Me!cmdReorderReport.Enabled = True
    3. Else
    4.   Me!cmdReorderReport.Enabled = False
    5. End If
  4. Create a Report and name it rptReorder - include all necessary Fields in the Report, (from an underlying Query), especially [Stock ID].
  5. In the Criteria Field of [Stock ID] within the Query, set the following Criteria:
    Forms!<Your Form Name>![Stock ID]
  6. In the Click() Event of cmdReorderReport, place the following line of code:
    Expand|Select|Wrap|Line Numbers
    1. DoCmd.OpenReport "rptRoster", acViewPreview
  7. cmdReorderReport will not be enabled unless [Stock Level] < [Re-Order Quantity]
  8. If thsi Button is enabled then clicking on it will generate the Reorder Report for the specific item as indicated by the [Stock ID] Criteria in the Query.
  9. Be sure to set the Query to the Record Source for the Report.
  10. I know it is a mouthful but if have any other problems, please let us know and someone will be glad to assist you. Good luck.
May 22 '07 #8

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

Similar topics

3
by: Chris | last post by:
I've been researching this on and off for weeks, and haven't come up with anything useful yet. If anyone knows how to do this, please let me know. From a Java applet running in IE 6.0 using the...
3
by: brian kaufmann | last post by:
Hi, I had sent this earlier, and would appreciate any suggestions on this. I need to make calculations for unemployment rate for three different data sources (A,B,C) for many countries and age...
3
by: John M | last post by:
Hi, I've been coming up against a failure of a report to display the result of a simple calculation. I have realised that this calculation cannot take place unless the field I am working on is...
9
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
5
by: Salad | last post by:
I have a textbox for storing the URL to a web page. I figured the person could simply copy the URL from IE and paste it into the text box. The client would like to have a more automated process. ...
1
by: Randall Parker | last post by:
I am using Forms authentication for people who come to a web site over the internet. But for people who are sitting right at the server and and using a browser on the server I want to allow...
4
by: tlyczko | last post by:
Hello, I have read about currency calculations, etc. in this newsgroup, and I understand that currency math will be sufficiently accurate for what I need to do for a mileage/expense report. ...
2
by: john | last post by:
I have 400 different Excel-spreadsheetfiles, same structure, all with only one record in it, and all residing in the same folder. Every now and then new Excel files are being added. In my Access...
6
by: trimba | last post by:
Hi guys, Have you created an application that provide Automated test for Access application. What I mean from the Automated test is The Access Form will be open, all text fields will be populated,...
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.