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

Append individual records from a form depending on current record

Hi there,

I want to have two tables in my database. One table will be a list of all raw materials used (called materials), and the other will be a list of all the raw materials which have been approved (called approved). Both tables have exactly the some column titles and data types (a copy and paste of the materials tabled, then renamed).

I have a form which contains a section for approval information to be added and then on the click on a button I want an append query to run which only copies the current record the user is viewing.

I have looked all over forums and dont understand some of the suggestions I have found regarding the INSERT, SELECT, FROM, WHERE terms. Do these terms get added to the criteria box of the query or elsewhere!

Can someone help, I am tearing my hair out over this!!!

Thank you! David
Mar 18 '14 #1
2 1291
Seth Schrock
2,965 Expert 2GB
Here is a link to a website that explains the basics of SQL code including SELECT and INSERT queries along with the FROM and WHERE clauses: www.w3schools.com/sql/default.asp. It is real easy to follow.

If you are just looking to copy the data from one table to another, then your SQL code would be
Expand|Select|Wrap|Line Numbers
  1. INSERT Approved
  2. SELECT * FROM Materials
If you only want certain rows to be copied over, then you need to add the WHERE clause at the end.
Mar 18 '14 #2
zmbd
5,501 Expert Mod 4TB
Both tables have exactly the same column titles and data types (a copy and paste of the materials tabled, then renamed).
and this breaks the rules of normalization [*]> Database Normalization and Table Structures.

I would be better to simply have one table with a column that indicated the current status... I have a database that handles it this way (I've simplified it considerably here):

tbl_approval_states
[approval_states_pk] numeric(long)
[approval_states_text]text(15)
Starting with 1 for the first record
Approved, Pending, Unapproved

tbl_chemicals_supplier
[chemicals_pk] autonumber
[chemicals_fk_chemical] numeric(long) 1:m with chemical table
[chemicals_fk_supplier] numeric(long) 1:m with supplier table
[chemicals_fk_approval_states]numeric(long) 1:m with approval_states table

Now I use a form on tbl_chemicals_supplier with combo-boxes for the foreign-key fields with the row-source set to show the human-readable text

You can see from there how easy it is to write queries so that I can pull a list of approved suppliers or all available suppliers for a given chemical or I can pull all unapproved, pending, or approved chemical suppliers for every chemical etc...
Mar 19 '14 #3

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

Similar topics

3
by: Charles Ranch | last post by:
Hello, I'll bet this is an elementary question. I have a text file I am converting and posting to a SQL database. But the first 15 records in this text file are going into a NOTES field in the...
2
by: Tony | last post by:
Hello, I am having difficulty in getting the current record of the current form to show after pressing a command button that takes me to another form. The command button takes me to another...
4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
2
by: Colm O'Hagan | last post by:
Hi there, I having a problem with a database I'm setting up, I would be delighted if someone out there could help. The database I'm setting up is a task register datebase, it will be used to...
5
by: John | last post by:
Hi If I have a form open, what is the code that is equivalent to using the File->Print menu with select record(s) option to print the form with the currently displayed record values? Thanks ...
8
by: anansi | last post by:
Hi I have a form called 'shiftviewer' and it contains a subform called 'all shifts for current month subform'. the subform is in datasheet view (access 2007) and the main form is a column...
2
by: SJ1000 | last post by:
Hi, I think I have a simple question that I just can't figure out. I want to have a command button on a form (via a macro) run a query to append the data on that form to another table.I want it to...
3
by: KevinC | last post by:
Hi All, I have two tables: tblLicensedPrem and tblLicensedPremHistory (these tables are identical). tblLicensedPrem contains records for licensed premises. Over time details of a licensed...
1
by: JonHuff | last post by:
I have a form in which users can create new records or modify existing records. All records are stored in one table. I want to be able to keep track of all changes made to existing records as well...
1
by: Jeff Karli | last post by:
I think I now understand how to use this forum. I hope I am following the rules now. I am a college student working on a database project that requires some VBA coding for the Event Procedures and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
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,...
0
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...

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.