473,836 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding selected records to a New Table...


I have an order form which has a field 'ProductID'.
This form has a button on each record to open a new form linked by
This new form is a continuous form and obviously, only displays the
records associated with that ProductID.

Basically this is part of a Product Packing Pick System. From my
products table, each product has a set default amount of items which
need to be packed. What I am trying to do is:

When a customer places an order, our users can bring up the packing
list associated to the ordered product and either select/de-select
certain items, depebding on the customers requirements.

On this pop-up form linked by ProductID, there may be six (6) items
listed. On this continuous form the user may select/de-select any line
item by pressing a button on each record. The button simply changes
another field on each record from YES to NO.

I then have a button at the bottom of the form which runs an APPEND
Query to only add the records displayed as YES to my new table. This
new table will hold the selected packing items for future reference
until the order has been shipped etc.

My code works, except it appends all the records (six) six times,
rather than starting on the first record, adding it to the new table,
move to the next and so on. It adds all six, then repeats itself for
however many records there are ?

My code under the button is:

_______________ _______________ ____

Dim rst As DAO.Recordset
Dim n As Integer

Set rst = Forms!ProductPa ckSelectorF.Rec ordsetClone
n = rst.RecordCount
Do Until rst.EOF

Me.Text32.SetFo cus
If Me.Text32.text = "Y" Then

Dim stDocName As String

stDocName = "PackingSelecto rREC"
DoCmd.OpenQuery stDocName, acNormal, acEdit ('Append Query)

End If



_______________ _______________ ______________
The fields on the new table have exactly the same name, so all I want
is a button on the form to add only the selected records marked 'YES'.
Each product ordered by the customer is marked with a JOB NUMBER. This
also needs to be recorded with each record.

The idea being that in future I can search for a Job Number and pull
up the Recordered Packing Items.

Appreciate your help on this. Maybe there is a better way to add
records one by one rather than using an Append Query in a loop.
Nov 13 '05 #1
2 2624
da***@scene-double.co.uk (David) wrote:
My code works, except it appends all the records (six) six times,
rather than starting on the first record, adding it to the new table,
move to the next and so on. It adds all six, then repeats itself for
however many records there are ?

Hi David,

Have you considered using a select query which filters for the 'Yes'
condition instead of duplicating your data?

Nov 13 '05 #2


Thanks for responding.
Let me explain further. I have a Table: Products
I also have a table: ProductPack

Products (1 to many) ProductPack.
ProductPack only contains the Packing Items for that product, linked via

In the Order Processing part of my order, when we enter an order for a
customer, we bring up a 'Job Number' for that new orderline and select
the Product. We can then hit a button which brings up a continuous form
listing all the packing items for that product. This form is based on a
query, based on the table ProductPack, with ProductID criteria set.

On the pop up form from the orders section, we can select yes/no against
each packing item.

I now need to record these selections for each Job Number not ProductID.
So, in the table ProductPack there will only be 'x' packing items for
each product.

At any one time, there may be multiple job numbers linked to the same
Product but with different Packing requirements. This is why I need to
record the selections to a new table. The packing records would be
deleted upon shipment in the system.

I have tried using an Apend query in a loop etc....i'm just confused on
how to get the selected records into the other table correctly.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1 abc 2 abc 3
by: mellie | last post by:
Hi there, SQL 2000 database with ASP I've found many things "out there" regarding updating and deleting multiple records with checkboxes but I can't seem to find anything about adding them. A user wants to create a price list for their client and they need to add parts to it in a separate table. I would like to display the list of parts and the user would select multiple parts to add to a price list by checking a checkbox and...
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a record such as: part number 202354-001 location C1-01
by: acni | last post by:
I have the following peice of code to try and send an email to selected contacts in my form.The problem is this line: StrStore = DLookup("", "qrySelectEmail", "??????") This looks up the email field in the records returned for the query qrySelectEmail. The final bit needs to tell it to go to the first record the first time the loop runs, then the second record the second time the loop runs etc… But I cannot figure out a way to do this,...
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the number of possible values is over 300. For data consistancy I've locked the subform so that the user can't add or change values manually without using the lookup form. My question is: What's the best way of adding the record to table B which the...
by: EricLondaits | last post by:
Hi, I have an ASP.NET page with a ListBox that is data bound to a table with a single field (it holds a list of valid IDs). The page also has a textBox into which you can add new valid IDs, one per line (this is in order to make the process of adding new IDs easy, since it's only done at time of configuration). I have no problem with retrieving the contents of the textBox, splitting it into a string array, validating the individual...
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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: 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: 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: 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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
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.
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.