Hello,
I am working on a very complex database and now I am trying to create an update query. The query is showing too few records. I am trying to update data in the table "inventory" with data from "workorder" table. The query is just copying the last workorder. I would like to update all new workorders to the inventory (can be until 100 records).
I would really appreciate your help! Thank you!
Imke
Oct 18 '06
46 2899
The inventory table is related to the workorders table through workorderNumber , the table workorders and SQ customers and sales are realted to each other through salesID.
I don't know how to relate the WorkordersNewVa lve table to these tables. This table shows the WOIndex which is included in the workordernumber . WorkorderNumber is built from salesID+WOIndex . Is that what you mean?
MMcCarthy 14,534
Recognized Expert Moderator MVP
WorkorderNumber is built from salesID+WOIndex
Can I get examples of the structure and content of both these fields.
The WorkorderNewVal ve table consists of the following fields:
Field Name Data Type
WOIndex Number
Part Text
Abbreviation Text
Material Text
Quantity Number
WOIndex content is the numbers 1 through 100. Part is e.g. Sideplate and the Abbreviation could be Sp.
The Workorders table consists of the fields:
Field Name Data Type
WorkorderNumber Number
SalesID Number
Quantity Number
Material Text
For the sale with salesID 3456 the workorderNumber s would then be 345601 through 3456100.
The Inventory table has the fields
InventoryID Number
WorkorderNumber Number
Quantity Number
Distinguishing Mark Text
etc.
The inventoryID already exists and the Distinguishing mark field is telling if the inventoryID is empty or not.
The problem that I have is that it is recognizing the first empty InventoyID but is not updateting with all 100 records. It is just showing me the record for workorderNumber 345699. Do you need more information?
I am going offline soon and will continue on monday. I thank you for your help, I really appreciate that.
MMcCarthy 14,534
Recognized Expert Moderator MVP Workorders Field Type
WorkorderNumber Number (PK)
SalesID Number
Quantity Number
Material Text
For the sale with salesID 3456 the workorderNumber s would then be 345601 through 3456100. Inventory Field Type
InventoryID Number (PK)
WorkorderNumber Number (FK to WorkOrders)
Quantity Number
Distinguishing Mark Text
etc.
The inventoryID already exists and the Distinguishing mark field is telling if the inventoryID is empty or not.
The problem that I have is that it is recognizing the first empty InventoyID but is not updateting with all 100 records. It is just showing me the record for workorderNumber 345699. Do you need more information?
Are you trying to do an update or an append (insert) query?
Are you trying to add workorders to the Inventory table?
If I would use an append query it would create new InventoryIDs, right?
I thought I need to use an update query because the inventoryIDs already exist. The query should just fill out the empty fields, for example "WorkorderNumbe r", "Quantity" etc., for existing InventoryIDs.
MMcCarthy 14,534
Recognized Expert Moderator MVP
The problem is you are trying to update a table that has no relationship to the table you are updating from or any other table.
Try the following:
UPDATE Inventory SET ([Drawing#], WorkorderNumber , Material, Remarks, [Distinguishing Mark])=(SELECT Left([Model#],5) & [Abbreviation], [SalesID] & [WOIndex], Material, Remarks, 'Changed' FROM WorkOrders WHERE WorkOrders.Sale sID=[Forms]![Sales Form].[SalesID]) WHERE WorkorderNumber Is Null; omit the following you can do them later:
Inventory.Descr iption = [WorkorderNewVal ve].[part],
Inventory.Quant ity = [WorkorderNewVal ve].[Quantity],
When I try to do the following, it is saying "Syntax error in Update statement".
UPDATE Inventory SET ([Drawing#], WorkorderNumber , Material, Remarks, [Distinguishing Mark])=(SELECT Left([Model#],5) & [Abbreviation], [SalesID] & [WOIndex], Material, Remarks, 'Changed' FROM WorkOrders WHERE WorkOrders.Sale sID=[Forms]![Sales Form].[SalesID]) WHERE WorkorderNumber Is Null;
MMcCarthy 14,534
Recognized Expert Moderator MVP
I just don't think it can be done. I'd a feeling the last one wouldn't work but thought it was worth a try.
Why are you adding the InventoryNo first it would be so much easier to do this as an insert query.
The problem is that we are having one main database and some satellite databases. Every person is working with his or her own database and the data will be imported to the main database. If I use auto number for InventoryID there will be some dublicates or some entries will just be overwritten. That is the reason why I thought we need to give each satellite its own inventoryIDs and use an update query. Do you see any other opportunity how to do the exchange?
MMcCarthy 14,534
Recognized Expert Moderator MVP
The only other way to do this is using recordsets in vba code. Leave it with me.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: http://ray1.net/ |
last post by:
Dear Readers.
Using Javascript in ASP I need a way of returning through ADO
(connection or recordset) the message returned via SQL when I run a
query that UPDATES, DELETES or an SP that returns a message.
So I basically when the below code gets executed I need a way of
returning the message if it's there and if not nothing.
a)
|
by: netpurpose |
last post by:
I need to extract data from this table to find the lowest prices of
each product as of today. The product will be listed/grouped by the
name only, discarding the product code - I use SUBSTRING(ProductName,
1, CHARINDEX('(', ProductName)-2).
I can get this result, but I had to use several views (totally
inefficient). I think this can be done in one efficient/fast query,
but I can't think of one.
In the case that one query is not...
|
by: http://ray1.net/ |
last post by:
Dear Readers.
Using Javascript in ASP I need a way of returning through ADO
(connection or recordset) the message returned via SQL when I run a
query that UPDATES, DELETES or an SP that returns a message.
So I basically when the below code gets executed I need a way of
returning the message if it's there and if not nothing.
a)
|
by: Larry Woods |
last post by:
I have a datagrid that is carrying all fields of a record...except one. Now
I want to update the underlying database via a dataadapter. The update is
working but the field that is "left out" is not there, of course. How do I
get that field back into the datatable for the database update?
TIA,
Larry Woods
|
by: bobabooey2k |
last post by:
I have an update query with one field having in its "Update to" cell a
DLookup statement. This query takes 2-3 minutes on 3000 records.
Can I avoid dlookup here using multiple queries?
An underlying subquery to this Update query involves a MAX function on
a date field, which is then used in the DLookup statement.
Any help appreciated. Thanks
Richard
| |
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |