Copy Table Post And Secondary Table

Jun 26, 2007

I have a problem... I have four tables(but my problem is limited to just two)
The tables are Orders, Customers, Items and OrderedItems
The two more detailed below creates the problem when trying to copy an already existing order to a new since the customers usally order the samethings over and over again.

Orders
IDOrders
IDCustomers
strSalesperson
strWhen
strSent

OrderedItems
IDOrderedItems
IDOrders
IDItems
iNumber
bPacked

So I have made a copy button on the order form. The copy button should do this:
1. First save the old orders IDOrders and IDCustomers (which it does)
2. Create a new order with old data (which doesnt do)
3. Copy all post in OrderedItems with a new IDOrdered using INSERT INTO and using columns

My SQL statement is like follows:
sSQL ="INSERT INTO Orders(IDCustomers, strSalesperson, strWhen, strSent, strComment) VALUES (" & itmpIDCustomers & ",'" & strSalesperson & "', '" & strWhen & "','" & strSent & "');"
But the reply I got is "Could not find output table 'Orders'" but I have checked the names over and over again but it doesnt work.

View Replies


ADVERTISEMENT

Tables :: Creating A Secondary Table

Oct 27, 2014

I have an Access database, where one of the tables is near the maximum amount of fields (241 of 255), was just wondering if I could set up a secondary table that would be linked to the original table by a specific field and would store the other fields that would like to add to the table.

View 7 Replies View Related

Insert Row Into Secondary Table From Maintenance Form.

Sep 24, 2005

Hi,
I can't seem to get this right...any help much appreciated:

I have a two tables LESSON<PAYMENT (One to Many)

LESSON
Lesson_ID (PK autonumber)
Lesson_Date (Date)

PAYMENT
Payment_ID (PK autonumber)
Lesson_ID (FK)
Payment_Date (Date)

I am maintaining LESSON using a simple form. On creating each new LESSON record, I also wish to insert a row into PAYMENT, using values from the LESSON table - Payment_ID(autonumber), Lesson_ID = LESSON.Lesson_ID, Payment_Date = LESSON.Lesson_Date

What is the best way to do this?
I have tried to add an Event Procedure to 'Before Insert' but I can't seem to get the syntax correct. Also, for this to work, do I need to paint all fields on LESSON form including (hidden) PK?

I have simplified the tables above but they are relevant to what I am trying to do. Any help would be much appreciated- am new to Access...rather frustrating.

Many thanks,
Simon.

PS I have searched through existing messages but can't see one that answers this, I apologise if this has been answered before- just point me to the orig post.

View 2 Replies View Related

Min/max From Secondary Table Without Returning Extra Rows From Primary

Mar 9, 2006

Hi all, don't know if this is possible, but right now I'm running a query and then performing Dmin/Dmax on each record in the recordset and it's running SLOOOOW. Perhaps if I can get it from a query it would be faster.

I have Table-A and Table-B with a one to many relationship. In the Table-A I preferably need to return only one row per record. From Table-B, I need to return the minimum and maximum record that corresponds to the ID in Table-A.

I am familiar with min and max, but it the join methods I've been using either return multiple rows per ID or none. Any way around this?

View 2 Replies View Related

Queries :: Append Records From Main To Secondary Table

May 14, 2014

I built an Append Query to take records of 'Leavers' from my Primary Table and add them to a Secondary Table named 'Leavers. This worked perfectly, but on reflection I determined that I needed to append a further column 'Notes' which exists in the Main Table but not in the Secondary Table.I amended the SQL statement as follows, but the query now fails stating that it doesn't recognize the field 'Notes'.

INSERT INTO Leavers ( [Member ID], Surname, [First Name], [Address 1], [Address 2], Town, PostCode, Phone, [E-Mail], Notes )
SELECT [Mail List].[Member ID], [Mail List].Surname, [Mail List].[First Name], [Mail List].[Address 1], [Mail List].[Address 2], [Mail List].Town, [Mail List].PostCode, [Mail List].Phone, [Mail List].[E-Mail], [Mail List].Notes
FROM [Mail List]
WHERE ((([Mail List].Leaving)=True));

Does this mean that one would need to recreate a new Secondary Table to incorporate the additional field? I have attempted to edit the secondary table by merely adding the 'Notes' field but that doesn't seem to be possible.

View 3 Replies View Related

Tables :: Limit Combo Box Results Based On Secondary Table

Dec 4, 2013

I have a DB with 4 tables:

Property (used for look-up values)
Service Type (used for look-up values)
Rate Table (uses the Property Table and Service Type Table and is used as a rate look-up table for the daily service table noted below)
Daily Service

Using the Daily Service table, I need to choose a property, choose a service type that is limited to the property (100's of service types, but a property may only have a limited number), and enter a quantity, and have the Rate Table return the specific cost of the service. I didn't think this was too hard in Access (2013), but I seem to be hitting a wall and spending too much time figuring it out. Now I am behind in my project.

I have been trying to do this in a table format, but have been unsuccessful in limiting the results of the Service Type combo box based on the property chosen.

View 2 Replies View Related

General :: How To Show Table In A Post

Aug 12, 2014

I've done a YouTube Video, showing 3 different methods of posting your table structure to a forum HERE:- MS Access - Copy Table Structure for Forum

Here is a Google Doc showing the first procedure of the three:- MS Access - Copy Table Structure for Forum (First Method)

Here is a Google Doc showing the Second procedure of the three:- MS Access - Copy Table Values for Forum

Here is a Google Doc showing the Third procedure of the three:- MS Access - Copy Advanced Table Structure for Forum

View 7 Replies View Related

Kinda Like Recent Post Macro Updates Table

Aug 13, 2007

ok i have this query.
Code:UPDATE [Claims Header] SET [Claims Header].status = 'I'WHERE ((([Claims Header].Claim_ID)=[claim id]));WHERE ((([Claims Header].Claim_ID)=[claim id]));
i want to have a button that runs this query but how do i pass over the claimid from my form? also when it's done running the query i want it to run a report.
so i was trying to make a macro, but how do i tell the macro to find the claim id from the form?

View 1 Replies View Related

General :: Copy Data From Local Access Table To Linked SQL Server Table?

Jan 13, 2014

I have an MS Access accdb with linked SQL Server 2012 ODBC tables. I am working on a procedure to copy data from local tables to these linked tables (identical schema). I did a simple

Code:

DoCmd.RunSQL "INSERT INTO linkedTable SELECT * FROM localTable"

This works, but is very slow. Way too slow. (INSERT copies the data one record at a time).

I would like to copy the data in a bulk operation, or operations that I can execute programmatically.

View 1 Replies View Related

Modules & VBA :: Copy Record To History Table And Then Delete It From Main Table

Jul 9, 2014

I have a form with a sub form. when a record is choosen in a combo box the sub form is filled out with a record.

what I am trying to do is have a button that will copy that record to a history table then delete it off the the main table.

I cheated by using the wizard to get the code to delete the record but I am having troubles modifying the code to copy that record to the history table. Here is the code below. I have tried to insert code in several places but it just errors out.

'------------------------------------------------------------
' Master_tbl_sub_fm
'
'------------------------------------------------------------
Function Master_tbl_sub_fm()
On Error GoTo Master_tbl_sub_fm_Err
With CodeContextObject
On Error Resume Next

[Code] ....

View 8 Replies View Related

Modules & VBA :: Copy Structure Of A Table To Make A Temp Table

Apr 20, 2015

I'm trying to copy the structure of a table to make a temp table. I'm using CopyObject (which also copies the data). So when I delete the data from the temp table, it also deletes data from the source table. Is the data linked? It should just be deleted from the temp table. Below is the beginning of the code. I've stepped through, and at the last step shown, the data in the source table deletes.

Code:
Dim strFile As String
Dim temp As String
Dim tbl As String
Dim db As DAO.Database

' error handle
On Error GoTo F_Error

[Code] .....

View 3 Replies View Related

Active Table And History Table, How To Copy On Deletion?

Feb 14, 2006

My 2nd post, and I am very new to DB and Access. I have a problem that I want to get help on. I want to set up a main form that is used to enter and delete all data for my table. I wish to add either a button or to make it automatically happen when a record is deleted, that it is first copied to a separate table with the same fields, except it also has a closed date that would be the date that the record was copied over. I know zilch about VB, VBA or any other language other than AutoIt, so assume I am what I am, an ignorant beginner.

I did look into the event somethihng like upondeletion or something... while trying to find help on this in the access and VBA parts of Office, but I do not know how to utilize the event with Basic or SQL, which I know none of either.

Any help or examples are very much appreciated.

**EDIT**
I do not require all fields to be recorded to the secondary DB (History), so if someone can just give me an example of how I would move two fields to a separate DB, I can hopefully learn enough from it to do more.

Thanks a Bunch!


EXAMPLE**
Current Loans (Table 1):
CustomerID
Name
Address
City
State
Phone

Customer History (Table 2):
CustomerID
Name
Phone

That gives an example to help understand what I need. I want to store the CustomerID, Name and Phone values of the record being deleted, to the History Table, which I am using as a closed account table for later look up.

View 14 Replies View Related

Automate Copy Table And Sequence Table Name

Oct 27, 2004

I have a user who wants to automate copying a table from our main database. Basically, he is naming the new table with the original table name and the current date. For example, Part_Table_9-3-04, Part_Table_9-4-04, Part_Table_9-5-04 etc for each day of the month.

He wants me to write a macro, module, or vb code that automates the steps.

I have DoCmd.CopyObject,"Table1",AcTable,"Table2" I want to concatenate the date function (now) or (today) with the new table name but can't seem to get this to work.

Any suggestions?

Thanks for helping,

Jeff

View 3 Replies View Related

How To Copy All Record On A Table To Another Existing Table?

Feb 3, 2005

I have a table with employees’ information. I want to copy all records in this table to another existing table “WorkTimes”. I do not want to edit my employee table, so therefore I want to copy all records to another table before editing/adding information in other fields. How I can do that with a macro or module?

Thanks in advance.

View 3 Replies View Related

How To Copy A Column From One Table And Insert It Into Another Table In The Same Db

Feb 3, 2006

How to copy a column from one table and insert it into another table in the same database

Hi, All,

I have two tables (old and new) sitting in the same database. The new table is the result of 'data cleansing' done by an external company. In the process (export and import via excel) two memo type colums in the table were truncated in excel.

To make the new table usable, I must therefore now copy/insert the two memo columns from the old table into the new table.

Both tables are already Access tables and sit in the same database. Both tables, of course, have the same number of rows.

I tried to high-light one column in the old table, clicked copy, then high-lighted a blank column in the target table, then clicked Paste, but got error msg: "This text is too long for this field. Try copying a shorter text", as if I had wanted to copy the whole column into one cell rather than one column into another column of equal length.

What is the best way to proceed?

Thanks for your help.

Adrian

View 4 Replies View Related

Copy Linked Table Into A Local Table

Jul 30, 2006

Well, heres the situation. I have a complicated query that refuses to work all the time using a linked table for the data (data is gathered from a FoxPro DB). If I copy the data into a local table in my database then the query will run fine.

The data needs to be updated only 1/month but I don't want to have to do it manually every month. I would like to use VBA to copy and paste the data from the linked table into my local table. Does anyone know of an efficient way to do this? I'm trying to avoid running a VBA loop and adding each record one-by-one (very slow).

View 2 Replies View Related

Copy Table Data To New Table Without One Record

Oct 24, 2005

hey guys,

how can i make a query to copy records from one table to the other, and leave out one record. the record has corrupted somewhere and is causing havoc on some forms.

cheers

View 4 Replies View Related

How To Copy Records To Different Table

Jun 22, 2006

Hi all

This gonna be a long one.... I've search the whole forum for answer to this problem, but couldn't find the one suitable enough.

I have a quote table with the following field:


QuoteName
QuoteDescription
QuotePrice

and booking Table:


BookingName
BookingDescription
BookingPrice

The real table is much more complex, but this will do for now.

When a client call up for a quote, their request will be added into the "QuoteTable". One name can occur many times depend on how many they ask for quote. Once they decided to proceed with the booking, all the records need to be transfered into "BookingTable".

Currently, I use either one of the following codes found in this forum:


Dim dbs As DAO.Database
Dim rstQuote, rstBooking As DAO.Recordset

Set dbs = CurrentDb
Set rstQuote = dbs.OpenRecordset("SELECT * FROM QuoteTable " & _
"WHERE QuoteName = ' " & Name & " ' ")
Set rstClient = dbs.OpenRecordset("BookingTable")

Do Until rstQuote.EOF
rstBooking.AddNew
For Each Field In rstQuote.Fields
rstBooking.Fields(Field.Name).Value = _
Nz(rstQuote.Fields(Field.Name).Value, "")
Next Field
rstQuote.MoveNext
rstBooking.Update
Loop


or


Dim lngOuterCounter, lngInnerCounter As Long
Dim dbs As DAO.Database
Dim rstQuote, rstBooking As DAO.Recordset

Set dbs = CurrentDb
Set rstQuote = dbs.OpenRecordset("SELECT * FROM QuoteTable " & _
"WHERE QuoteName = ' " & Name & " ' ")
Set rstClient = dbs.OpenRecordset("BookingTable")

If Not rstQuote.EOF And Not rstQuote.BOF Then
rstBooking.AddNew
For lngInnerCounter = 0 To rstQuote.Fields.Count - 1
rstBooking.Fields(lngInnerCounter) = _
Nz(rstQuote.Fields(lngInnerCounter), "")
Next lngInnerCounter
rstBooking.Update
End If


But none seem to work. Can anyone help?


Cheers
arnodys

View 8 Replies View Related

Copy Table On A Form

Oct 23, 2004

In the database I am developing, users have to be able to copy a table, no data, structure only. The source table is always the same one. Users have to be able to specify the name of the new table.
I would like to have them do this on a form, easy of use is important. Any ideas on this? Thanks. Trucktime

View 2 Replies View Related

Copy Record From 1 Table To Another

Aug 29, 2006

Hi Everyone

I wonder if anyone can help me with code that i can use to copy a single record from table1 to table2

that i can use in a subroutine.

Thanks in advance to anyone that may offer some help

Kindest regards

Tony

View 1 Replies View Related

Copy Table With Prompt For New Name

Aug 13, 2007

Once at the beginning of each month I extract all new cases from last month into a table. The table has a generic name as I repeat this step monthly. I would like to save or archive the data each month without having to manually copy and paste the table and rename it, prior to the new extraction, so that I have a record of each month. The archived table will not be used in any queries or reports.

The table I want to copy and rename is named 'tblSampleFrame'

At the beginning of the month before I delete the contents of the 'tblSampleFrame' to pull the new data, I would like to copy the old table and include a date in the new name. How would I set up a button on a form to copy the file and prompt me for the new file name? The new name would be 'tblSampleFrame_mmyyyy' where I can specify which month and year.

View 3 Replies View Related

Copy Result Into The Table

Sep 15, 2007

Hi all, how can I have the result which is shown as "DateEnd" on the form available on the table. right now if I open the table "tblShift" the fields are blank!
Thanks

View 3 Replies View Related

Copy Table From One Back-end To Another

Sep 22, 2005

I have a database that acts as a front end for two different back-end databases. What I want to do is be able to copy a table from back-end #1 into back-end #2.

My first stab was to try to do a TransferDatabase on the linked table from b-e #1, but that just put a link in b-e #2, and not the actual data.

Can this be done?

Thanks,
David

View 4 Replies View Related

Copy Data Into Another Table

Oct 5, 2006

Hi:
Can any one please help me when user select 2 dates from DDLDate1 10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I need to create multiple records in the another table on the basis of two dates like that.

Data in continous form table1
-----------------------------
Data entered in continous form
10/09/2006 10/12/2006 John
10/12/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

Required data into table table2
10/09/2006 10/09/06 John
10/10/06 10/10/06 John
10/11/06 10/11/06 John
10/12/06 10/12/06 John
10/13/06 10/13/06 John
10/12/2006 10/12/2006 Petty
10/13/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

I am currently using a continuous form where there are two drop downs one for AppDate and other for EndDate. I need a script here once use close the form, Script check the data and create multiple records on the basis of date selection into table2. I am using two tables. One for the continous form and the other for the reports (Both have same fields). Continous form table i empty it every time once it close. So i need the result into another table assume form table name is table1 and table where i need multiple records name is table2.

Thanks.

View 1 Replies View Related

Queries :: SQL Copy From One Table To Another?

Dec 9, 2013

I have created a table1, with 3 fields: A, B and C, with 500 rows.

I want to copy this data over to table2 starting at row 700.

What is the sql for this.

Additionally I would like to in the 4th column to write November in the same copy over of the 500 rows.

View 1 Replies View Related

Modules & VBA :: Copy Value To 2nd Table

Jun 18, 2014

I have a database with two tables, and a form that is bound to the 1st table. I have a duplicate record button on the form. One of the functions I want to happen is when the duplicate button is pressed, one value is copied from the form and added to the 2nd table. The tables are basically set up the same with an ID column which is the key and an autonumber, and the second value is a number. So I want to copy the number to the other table and add a record. What is the best method? Can I use an insert into and just copy from a variable, or is the better method with a recordset. Either way, I have not been able to figure this silly thing out and it is preventing me from moving forward with this database.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved