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

Using Recordset to edit a table

Hi there,

I must point out first that I am a novice in VBA code.

My problem is that I need help to write the VBA code. My problem is as follows:

1) I have a table named "Barcode_of_goods"
The field that I will use in the table are:
i) Barcode_goods (Text Field)
ii) Minimum ReOrder Quantity (Number)
iii) OrderingStatus (Text)

2) I Have a query named "Actual Stock Report"
The field I will use in the query are:
i) In Hand
ii) Barcode_of_goods

3) I have a form named: Customers Quotation View and Edi + a
sub form named "Sales Subform1"
The field I will use is:
i) Barcode_of_goods
ii) Qty_Sales

I have a button in the the form Customers Quotation View and Edi.
On click I need it to do the following:

Run through the record in the Subform one be one, check the field "Barcode_of_goods" with the "Barcode_of_goods" in the query "Actual Stock Report" and see if "In Hand" minus "Qty_Sales" is less than "Minimum ReOrder Quantity" in the table "Barcode_of_Goods" update "OrderingStatus" to "Re-Order" else do nothing.

Please can someone help me to write this.

Thank you.
Apr 13 '16 #1

✓ answered by Seth Schrock

It would actually be easier to create an UPDATE query and run that once the transaction is done. First create a regular query and join your Barcode_of_goods table to the Actual Stock Report query and put a WHERE clause that filters for [In Hand] <= [Minimum ReOrder Quantity]. Run the query to make sure the results are what you are looking for and then change the query to an UPDATE query and set your OrderingStatus field to "ReOrder". This method will actually be faster to create and also to execute.

2 995
Seth Schrock
2,965 Expert 2GB
It would actually be easier to create an UPDATE query and run that once the transaction is done. First create a regular query and join your Barcode_of_goods table to the Actual Stock Report query and put a WHERE clause that filters for [In Hand] <= [Minimum ReOrder Quantity]. Run the query to make sure the results are what you are looking for and then change the query to an UPDATE query and set your OrderingStatus field to "ReOrder". This method will actually be faster to create and also to execute.
Apr 13 '16 #2
I have done as you said. It works like a charm. It was so easy that I complicated the situation completely.


Thank you. Great job.

Expand|Select|Wrap|Line Numbers
  1. [Actual Stock Report]![In Hand]<=[Barcode_Of_Goods]![Minimum Reorder Quantity]
Apr 13 '16 #3

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

Similar topics

3
by: -Michelle- | last post by:
Hi Using A2003 on XP I am wondering from the MVP's and others, what is the most efficient way (in terms of time to process) of updating data in a table, using the docmd.RunSQL or Recordset ...
3
by: Hartmut Schroth | last post by:
Hi, I need a solution for the following problem: In the item template of a datalist control I have already a button control with the commandname set to "select" to perform some specific...
1
by: Stephen Lynch | last post by:
What is the best way to insure that an edit table fields are saved on an exit. For example, I have an edit panel on a page. I do not want to post back on every field, but if an end user goes to...
11
by: Sheau Wei | last post by:
i wish to know how to create a dinamically edit table entries .can u help me ?thanks.
1
by: sowmyavenkat | last post by:
hi all, Iam working on a Maintainance and enhancement project. It was developed by somebody. Now there is a bug which is to be solved. Can any body help me to find out which stored procedure is...
1
by: jackiepajo | last post by:
I want to delete a picture that i uploaded but icannot delete... by the way im using recordset but i do not how it really works... i just want to have some delete functio... please help..
1
by: munusoni | last post by:
Hi everyone, i am using ASP 3.0 to create web pages for a college project and i am having problems in using recordset object through session object to pass data to all web pages.Anyone tell me how...
16
by: BlackEye | last post by:
Hi all! i want to validate the user name and password using an sql table i created. i have tried the following code: SqlConnection myConnection = new SqlConnection("data...
4
dreamfalcon
by: dreamfalcon | last post by:
Hi! I'm looking for a method to edit table cells. Something similar to Google Docs, that when the user double clicks the cell, it replaces the content with a textbox that grows automatically, and...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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.