473,549 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append Query with added intel

22 New Member
Hi! can you help?
I am looking to write a parameter in an append query to assign a value to one of the fields I leave blank.
I need to replace CHID with IID
Example - I have an NB (not billed)order, CHID 10, with three lines, description, price, etc:
CHID 10,1,Tomato Sauce,2.00,EA
CHID 10,2,Spaghetti, 1.00,EA
CHID 10,3,Chianti,7. 99,EA
When my corporate office generates an invoice for this, the invoice has it's own IID, which i identify before I append the query.
Is there a way to write into the SQL what number to use in IID?
I am only appending one CHID at a time.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO ChinaOrderDetails 
  2.     ( CHQTY, CHPN, CHPN2, CHPNREV, CHPNNOTE, CHPRICE, CHUNIT )
  3. SELECT ChinaOrderDetailsNB.CHQTY, 
  4.     ChinaOrderDetailsNB.CHPN, 
  5.     ChinaOrderDetailsNB.CHPN2, 
  6.     ChinaOrderDetailsNB.CHPNREV, 
  7.     ChinaOrderDetailsNB.CHPNNOTE, 
  8.     ChinaOrderDetailsNB.CHPRICE, 
  9.     ChinaOrderDetailsNB.CHUNIT
  10. FROM ChinaOrderDetailsNB
  11. WHERE (((ChinaOrderDetailsNB.CHID)=[What Order ID are you moving?]));
Aug 6 '19 #1
3 1002
twinnyfo
3,653 Recognized Expert Moderator Specialist
MC42015,

I am not exactly sure what you are asking, because you are not INSERTing either the CHID or the IID into your table, so I am not sure why you need it.

Also, how are CHID and IID related? Is IID a field in your Table ChinaOrderDetai lNB? If not, then there is no point in incorporating it into your code.

Perhaps we need a few more details in order to help you out with this one.

Thanks!
Aug 7 '19 #2
MC42015
22 New Member
OK - sorry for the confusion! You are not seeing that because i am manually going into the table and typing it in.
This is the reason for my question.
Two tables make an Order - tblOrder CHID - date, order number, order date, etc; and tblOrderDetails relates to CHID with qty,line item,price,etc.
My process is an order is recorded with CHID and I monitor it there until it becomes an Invoice IID. Two tables make an Invoice, exact structure as the order, so my append query is inserting the tblOrderDetails from CHID into the tblInvoiceDetai ls, but now needs IID.
When I run my append, I want it to ask me: [what is the IID?] and insert it into each line that is going into tblInvoiceDetai ls.

Hope that makes sense
Aug 7 '19 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
Why not add IID to tblOrders--then when you identify the IID, that IID will be associated with CHID.

Again, if you have a proper relationship established between your two tables, you need merely to have main form, bound to tblOrders, with corresponding controls for your required fields. Then, you have a sub-form, bound to tblOrderDetails . In the properties for that subform (once it is on the Main form), you must set the Parent-Child relationship to be CHID. Then, every time you add a new CHID, and add items to the order, tblOrderDetails will populate with new records based upon the new CHID.

There should (almost) never be a need to create forms the way you have them set up now. Not to mention that I can't see how your code would have ever produced satisfactory results. Hence your question.

Hope this hepps.
Aug 7 '19 #4

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

Similar topics

0
1742
by: karinski | last post by:
Hi All, I have a split f/e - b/e setup on my database with RWOP queries on the front end. The code below gets a PO number(s), and vendor name from a multi choice list box on another form. It then assigns these values, plus a new receiving number, to the current form. The SQL string is an append query that copies select fields from the PO...
13
4210
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a solution here - until now. This one is driving me crazy. I am making my first attempt at creating a runtime application. I am using Access 2003...
4
5746
by: pmacdiddie | last post by:
I have an append query that needs to run every time a line item is added to a subform. The append writes to a table that is the source for a pull down box. Problem is that it takes 5 seconds to run. This makes adding lines to an order too slow for the users. The result of the query provides real time availabilty, so I really do need this...
3
4533
by: DHarris | last post by:
I created a continuous form in Access2003 based on a query that users review customers and once reviewed clicks on a command button that executes an append query to update a table of the reviewed customer(s) data. The table includes the fields: customer_number, shipto_number . I also need to include the date reviewed and the user who performed...
7
5952
by: pltmcs | last post by:
I am trying to generate some records from one table into another. The problem is that the new table has an autonumber field (PID). The PID is part of the primary key since it is possible to have duplicate records. I did not include the PID in my append query since I just assumed it would be added automatically. My append does not add any...
4
7589
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to an excel spreadsheet. There are two tables. One is a list of general contacts, and the other is a list of clubs. The clubs contain members who...
8
3163
jinalpatel
by: jinalpatel | last post by:
I have two tables. tblClass and tblWithdrawn. On my main form(bound to tblClass) I have several data entry fields like Date withdrawn, Status (active or withdrawn) Date Classified etc. Also there is one command button called cmdAppendDelete. On click this command button two queries are run .(append and delete) When user selects Status =...
2
1401
by: bmac | last post by:
I would like to know if I can force an append query in Access VBA to continue if it encounters a field in the source table that does not exist in the target table and just ignore that field. My dilemma is that I am trying to import over 900 tables that were downloaded from the internet. They represent data from multiple schedules over multiple...
3
1943
SteHawk85
by: SteHawk85 | last post by:
Hi I have an append query which won’t add new records. I have two tables and I need the new data from TableA (FSP Attainment Import) to add a new record into TableB (Master), however I only need it to add the new data and ignore the old. For example if TableB holds (Row 1) A B C D (Row 2) B C D E (Row 3) C D E F and TableA holds (Row 1) A B C D...
26
3917
Nauticalgent
by: Nauticalgent | last post by:
Greetings Access Commandos, While I was looking for a solution to my problem, I came across this thread: https://bytes.com/topic/access/insights/907658-progress-indicator-access And although I think giving your clients something to look at while the Access Gnomes are making sausage is ALWAYS a good idea, I still want to fix why my query,...
0
7527
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, 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...
0
7459
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7485
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...
0
7819
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 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...
0
6052
agi2029
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...
1
5377
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5097
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...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
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 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.