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.
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.
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
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
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.
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.
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?
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.
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).
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.
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.
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.
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
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
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
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.
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.
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.
What I need to do is copy some fields from one table to another after updating via a pop up form.
Explanation:
Form [frmWorkItem subform] and [frmReactiveWorkPoList] are located on a tab control (Tab110, pages 0 and page1) and are linked by [ClientID] to the main form [frmReactiveTracker]. The functionig of this set up works fine.
The process of entering data starts with [frmWorkItem subform], here i use a popup form to enter a new record and when the popup closes the new record is seen in [frmWorkItem subform]. Unfortunately there are five duplicate fields in table frmReactiveWorkPoList which can't be changed now (the result of bad normalisation and now too much work to change it).
The duplicated fields in the newly entered record in [frmWorkItem subform] need to be copied to the respective fields in frmReactiveWorkPoList either when the popup closes or some other more efficient method.
I have attached the sample stripped down database. To start open frmReactiveTracker and pick the third name from the drop down list.
Please could someone enlighten me on the following scenario I have.
I would like to get from a button click the information from Sheet_subID (cat_parameter) copied into the Main sheet Description field. I think this maybe would be done with a loop? Taking one from in tunr from Sheet_subID and then putting it into the description filed until al cat_parameters have been copied.
This information is not beng duplicated as such because the text that lands in the description field will be modified slightly by the user. The information contained within the Sheet_subID are for presets for in the case below Compensator Setting 3. Compensator 1 would have different presets.
OK, here is a weird one, at least it seems weird to me. I have a field on a table, or query result, doesn't matter which, and it looks like this:"55264"25468"4562"123etc, etc.Now I need to copy that and paste it into the notepad in Windows. When I do that the pasted data looks like this:"""55264""""25468""""4562""""123"I have looked at it on the clipboard and it also looks like the above. I really need this data to paste to the notepad just like it is stored on the table (with one double quote only). It's one of those strange sounding things, please do not ask me to explain why...I just need it like that.Why the heck does the extra quote get added to the front and one get placed on the end?Test it yourself and see.Thanks
I have a field called Shipdate. I have created a new field that is called invoicedate. What I want to do is copy all of the shipdates and paste them in the invoicedate field for my old records. From here on out they would be distinct fields but for old records and reporting purposes I need those dates.
Im a newbie at developing access databases. I have just finished creating my first application. The problem i have is that i would now like to create an exact copy of my table definitions without all the junk data i have been entering while i have been creating the application. I would like to use this copy so i can link the finished database to it. Could someone please offer me some advice as how to best go about doing this ?
I need to make changes to a table already containing data. Currently the autonumber field is simply there as a primary key, but I now wish to use it for another number field (Accession No) which was previously completed manually.
As this doesn't seem possible or practical (as I need the flexibility to overwrite the number sometimes), I just want the autonumber to also appear in the Accesion No field when a new record is added (but be manually overwriteable).
I've had a play with default values and lookups, but with no success, and haven't found anything on the forum. Where am I going wrong, or is this just not possible?
Is it possible to copy the current record on a form to a different table? Example:
Form Name = Training Orders bound to a table with the same name. 2nd Table Name = History
I need to export certin fields from the Training Orders Form into the History Table. Below is the way I am trying to make it happen, but it does not work.
With Me.RecordsetClone .AddNew ![Forms]![History]![Last Name] = Me.[lastname] .Update