473,499 Members | 1,672 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 999
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 ChinaOrderDetailNB? 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 tblInvoiceDetails, 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 tblInvoiceDetails.

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
1737
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...
13
4199
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...
4
5733
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...
3
4522
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...
7
5943
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...
4
7582
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...
8
3159
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...
2
1396
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...
3
1938
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...
26
3915
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...
0
7007
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
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7388
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
5470
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,...
0
4600
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...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.