Queries :: Archiving Data From Multiple Tables

Jun 24, 2013

I have a database with employees. The tables are as follows:

Deptdatatble
Depttble
Emptble
HRtble
Servicetble
Servicedatatble
Archivetble
Classestble
Classdatatble

At certain times, I want to archive employees out (lets say they are terminated). When I do this, something strange happens. If an employee has 4 records in the servicedata table and 4 records in the Classdata table, then it exports out 16 records (4 x 4). I would expect it to export out 8 records.

View Replies


ADVERTISEMENT

Archiving Records From Two Tables

Nov 24, 2006

I have a database for tracking tasks. each task may have associated documents for it which are kept in a separate table.

I have an archiving procedure which takes closed or completed tasks (from the main table) and appends them to an archive table but it leaves the associated documents in the second table, or if I enforce integrity it will delete them.

Anyone have a suggestion on how i can archive records from two tables at the same time I include the archive code for your information....

Many Thanks as always for your help and assistance

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''
' procedure archives closed or complete records to archive table and then '
' Deletes original records from source table '
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''

On Error GoTo Err_btnArchiveAdhoc_Click

Dim strMySql As String, strResponse As String, intRecordCount As Integer

Dim cnn As ADODB.Connection
Dim rstTemp As ADODB.Recordset

strResponse = MsgBox("By clicking Yes you will Archive any closed or" & _
vbCrLf & "completed tasks and delete the original records from the table", vbExclamation + vbYesNo, gstrAppTitle)
If strResponse = vbNo Then
Exit Sub
Else
Set cnn = CurrentProject.Connection
Set rstTemp = New ADODB.Recordset

' builds sql string to append closed or complete records from the original table into archive table
strMySql = "INSERT INTO tblArchiveAdHocTasks ( Seq_Number, Item_Type, TaskTitle, Task_Description, TaskActions, StartDate, TgtDate, ReviewDate, TaskLead, Status, LastUpdatedBy, estHours, Progress, PersIDAssocPerson1, PersIDAssocPerson2, PersIDAssocPerson3, PersIDAssocPerson4, PersIDAssocPerson5 )"
strMySql = strMySql + " SELECT tblAdHocTask.Seq_Number, tblAdHocTask.Item_Type, tblAdHocTask.TaskTitle, tblAdHocTask.Task_Description, tblAdHocTask.TaskActions, tblAdHocTask.StartDate, tblAdHocTask.TgtDate, tblAdHocTask.ReviewDate, tblAdHocTask.TaskLead, tblAdHocTask.Status, tblAdHocTask.LastUpdatedBy, tblAdHocTask.estHours, tblAdHocTask.Progress, tblAdHocTask.PersIDAssocPerson1, tblAdHocTask.PersIDAssocPerson2, tblAdHocTask.PersIDAssocPerson3, tblAdHocTask.PersIDAssocPerson4, tblAdHocTask.PersIDAssocPerson5"
strMySql = strMySql + " FROM tblAdHocTask "
strMySql = strMySql + " WHERE (((tblAdHocTask.Status)=6 Or (tblAdHocTask.Status)=10))" ' status 6 is closed and 10 is complete
DoCmd.SetWarnings False

'DoCmd.RunSQL strMySql ' runs append query
rstTemp.CursorLocation = adUseClient
rstTemp.Open strMySql, cnn, adOpenDynamic, adLockOptimistic


DoCmd.SetWarnings True ' turn warnings back on
' deletes records that have been archived above
strMySql = "DELETE tblAdHocTask.Seq_Number, tblAdHocTask.Item_Type, tblAdHocTask.TaskTitle, tblAdHocTask.Task_Description, tblAdHocTask.TaskActions, tblAdHocTask.StartDate, tblAdHocTask.TgtDate, tblAdHocTask.ReviewDate, tblAdHocTask.TaskLead, tblAdHocTask.Status, tblAdHocTask.LastUpdatedBy, tblAdHocTask.estHours, tblAdHocTask.Progress, tblAdHocTask.PersIDAssocPerson1, tblAdHocTask.PersIDAssocPerson2, tblAdHocTask.PersIDAssocPerson3, tblAdHocTask.PersIDAssocPerson4, tblAdHocTask.PersIDAssocPerson5"
strMySql = strMySql + " FROM tblAdHocTask"
strMySql = strMySql + " WHERE (((tblAdHocTask.Status) = 6 Or (tblAdHocTask.Status) = 10))" ' status 6 is closed status 10 is complete
rstTemp.CursorLocation = adUseClient
rstTemp.Open strMySql, cnn, adOpenDynamic, adLockOptimistic

End If
MsgBox "Export Complete ", vbInformation, gstrAppTitle
Exit_btnArchiveAdhoc_Click:
Exit Sub

Err_btnArchiveAdhoc_Click:
If Err.Number = 2501 Then ' runtime error as user cancelled delete part of query
Exit Sub
End If

MsgBox "'Error" & Err.Number & "'" & vbCrLf & Err.Description

Resume Exit_btnArchiveAdhoc_Click

End Sub

View 6 Replies View Related

Moving/ Archiving Data

Jul 24, 2006

Hi all,

currently on my db it stores data on various projects, and these projects are sorted by a status of on hold, on going, or finished. What im trying do is move only the projects that are finished but still keeping a record of them so we can view them in the future.

i was thinking maybe i could move the finished projects into another db? but not sure how to do, or is there a better way to achieve this?

thank you

View 2 Replies View Related

Archiving Data Each Time It Is Updated

Jun 27, 2005

Hi, I have a form which is made up for 3 tables and I am trying to create an append query for each one in order to keep records of data before it is updated. The append queries seem to work but they append all data rather than just one selected record. I know I will next need to create a macro which can be used each time a record has been updated and a copy is sent to the archive. Can anyone help me with this, or have any useful suggestions?

Thanks.

View 2 Replies View Related

Modules & VBA :: Archiving Data - Table Structures Are Identical

Jul 26, 2013

I'm trying to create an archiving routine as my database is becoming very large. For about 10 tables I want to shift certain records to an external database which would have the required 10 tables with the same table names and structure.

So far so good. I now want to automate everything using vba. I can see how to use the INSERT INTO statement but I don't want to have to name every field as there are hundreds. I just can't see how to do this.

If the table structures are identical how do I neatly shift a bunch of records from one to the other using code.

View 1 Replies View Related

How To Set Criteria For Archiving Data Using Form-based Parameters

Dec 4, 2012

I'm trying to create an archiving system, where i use a simple Append Query followed by a Delete Query.

A typical criteria for the Append Query is less than Date()-30...so any records older than 30 days can be appended to an archive table. This works fine when i enter it in the Query Design criteria row.

But, I would like to make this user-defined. I have set up an unbound form as shown in the first attachment...and made a global variable entitled 'ArchiveDays'. I am hoping to use the variable to act as the criteria for the append criteria. (Please note that in the screendump...they can select an option button if they just want to stick to 1 month old. I also show you my assignment operations there).

My question is... how do i get the variable 'ArchiveDays' value to be the criteria for my append query....

View 14 Replies View Related

General :: Archiving Data - Improve Response Time Of Database?

Apr 30, 2015

Will archiving older data improve response time of a database?

What is the best way to archive data knowing that older records will still be accessed twice a year?

View 2 Replies View Related

Import Excel Data From Multiple Sheets Into Multiple Tables In Access

Aug 25, 2012

I would like to know which way is the best way to import excel data from multiple sheets in to multiple tables in access.

For example data from Sheet1 -> Table1, Sheet2->Table2, Sheet3->Table3 etc...

I have tried using this:
Cmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel5, "Table1", "C:Importedfile.xlsx", True, "Sheet1!"

Ironically, data from Sheet2 and Sheet3 seem to be properly imported in to table2 and table3, but some of the data from Sheet1 seems to be missing in Table1 after import.

Any other ways to import the data?

View 1 Replies View Related

Queries :: How To Count Records Based On Multiple Criteria From Multiple Tables

Jan 4, 2014

I need to count records based on multiple criteria from two different tables. I have two tables (i.e. "tblTasks" and "tblTaskHistory"). The tables have a one-to-many relationship based on the "TaskID" field. "tblTasks" has a field called "AssignedTo" and "tblTaskHistory" has a field called "TaskStatus". I need to know how many tasks have been "reopened", the "reopened" status is located in the "TaskStatus" field in "tblTaskHistory". I need this count against a unique listing of employees which can be found in the "AssignedTo" field in "tblTasks".

View 4 Replies View Related

Queries :: Possible To Set Multiple Conditions Across Multiple Tables

Apr 10, 2013

Is it possible to set multiple conditions across multiple tables using OR in a where clause? For instance, can you run where......

(table1 = 'test') or (table2 = pass) or (table2 = "fail) AND (class = 'SQL');

View 1 Replies View Related

Queries :: Combining Data Results From Multiple Queries

Sep 30, 2014

I am working on a report that has some special characteristics.

Let's say I have a list of groups of Vendors in a table, complete with VendorID. I have 3 other tables that use the VendorID: Complaints, Complements, and Terminations.

Each of these tables has a date that the Complaint, Complement, and Termination notice was received.

Every Fiscal Quarter, a report is pulled that looks back over the 4 preceding quarters to determine if a 5% threshold has been crossed by any of the vendor-groups in regards to the amount of Complaints they received.

The equation used for that is : (complaints/vendors_in_group)*100

It is imperative that the information has the current fiscal year and fiscal month (which I am tracking with functions from MS website), and I need to be able to store the information attached to the fiscal year and month.So when a user goes to the form and inputs the desired Fiscal Year and Fiscal Month, the database can display the 4 previous quarters of information...split into Q1, Q2, Q3, and Q4.

What I would like to have happen is to be able to have one table where the information is stored, quarterly, so that it can be retrieved for the report.

Questions:
1. Is it possible to have one line, per VendorID, that has the total number of Complements, Complaints, and Terminations, as well as the threshold percent stored in a table? Right now, I am getting LOTS of duplicates and blank lines when I try to put them all together. It has the right data, but takes about 10 rows per VendorID.

2. It is very important that the total number of Vendors in a group be captured on that quarterly report, so maintaining that number, in the same table, is essential and must be tied to the VendorID.

3. I have looked at Union Queries and Crosstabs, but I just dont know enough about them to make it work.

View 4 Replies View Related

Data From Multiple Tables

Jul 22, 2005

Hi All,

I have designed a form that holds data from a table called Purchase, it also has got 3 more fields that are coming from another table called Master. These 3 fields, Code No, PartNo and Description are same in both tables. All i need is a way to bring the data of the stock table on purchase form. As soon as i enter code number in code field, it should check in stock table if the same code exist, if yes then it should bring the all 3 fields in purchase form and display.

Hope someone out there will return my call.

Warm Regards,


Darno

View 1 Replies View Related

Addidng Data To Multiple Tables

Apr 26, 2006

I have a form, created from a query. THe query contains an links about six tables using an AutoNumber ID.

OK, so when users enter their data into this form, I would like the autoincremented number to increase in each of these tables. The catch is that when the user enters data he/she does not have to enter data into every field.

So, some of my tables do not auto-increment and some do. How should I go about resolving this so that when someone enters new data, each table's ID is autoincremented no matter if that table contains information immediately or not? Please Help.:confused:

View 1 Replies View Related

Populating Multiple Tables With Data

Nov 8, 2004

I haven't used access for a long time so I am very rusty.

I have a few tables but I'll just use two for an example:

Table A
Ticket No
Part No
Defect Code
WorkCenter No
Clock No
(Ticket No is Primary Key)

Table B
Clock No
Supervisor
Employee
(Clock No is Primary Key)

Is there a way for me to create a form, that when Clock No is entered it will be placed in both tables?

Thanks in advance.

View 2 Replies View Related

Help With Adding Data To Multiple Tables

Oct 24, 2005

hi, i am new to access and struggling so any help would be great...

i have a db with 3 tables. students contains a Primary Key ('studentid') and then 'firstname' and 'lastname' fields. The two other tables (contactdetails, coursedetails) have 'studentid' as a Primary Key and then they each have other fields.

I set up relationships between the tables (1 to 1) but i would now like to create a form that will allow me to enter data to all three tables at the same time. (this would be ideal as it keeps the data normalised) if this isn't possible i would like to create a form that adds the 'studentid' record to each of the tables.

let me know if you need anymore details but if someone can point me in the right direction it would be cool.

cheers

View 11 Replies View Related

Drawing Data From Multiple Tables

Mar 17, 2007

I am a new user to access and are therefore seeking the assistance of a more experienced user (I'm sure this will be an easy one for all out there).

I want to be able to get records from different tables after the table name has been chosen.

In other words and to be a bit more specific, at the moment in one table I am selecting the tables I want to get information from. Once I select the tables I need to then be able to extract the required data from the selected tables and then put it into a new table with summary totals.

View 8 Replies View Related

Data From Multiple Tables Without Relationships

Aug 15, 2006

K,

Maybe a noob question, but I'm still learning access (I know a little late at the age of 37, but better late then never).
I have a form with several tabs, linked to a table with employee information, works like a charm.
Now, my last tab is called settings, maybe no need to say that the information from this tab needs to be called from a different table called settings.
Certain information, like version number, department, etc I want to display all the time in the header and I want to be able to manipulate that information through the settings tab.
I definately don't want any relationships with the employee table.
Is there a simple way to achieve this, I tried drag and drop but this leads to errors, so definately I do something wrong here.
Much appreciated,

View 6 Replies View Related

Data From Multiple Tables In One Subform?

Oct 5, 2006

Hi!

First of all, I'm kind of a newbie to all of this, but not entirely, bare this in mind please ;-) Also I'm from the Netherlands and my english might be a bit rusty, so bear with me if you please.... :-)

I'm having a problem for which I cannot seem to find a solution. Below I've outlined the situation:

I have a couple of tables up to now:

CustomerTable
CaseDateTimeTable
CaseTechInfoTable

CustomerTable has got a primary key: Clientnumber
CaseDateTimeTable has primary key: Casenumber
CaseTechInfoTable has no primary keys.

CustomerTable only includes (apart from all adress info etc) the clientnumber field which is of importance in this case i think.
CaseDateTimeTable includes both Casenumber and clientnumber.
CaseTechInfoTable also includes both Casenumber and clientnumber. Only both other tables have Primary keys, and this one doesn't.

I've created a relation between CustomerTable - Clientnumber and CaseDateTimeTable - Clientnumber.
Another relation I've made is between CaseDateTimeTable - casenumber and CaseTechInfo - casenumber.

Now, I have made a form in which the name and adress data is fed into the database, in normal form view. Below these textboxes etc. I've created a SubForm in datasheet view in which the existing cases from the at that time selected/displayed customer should be displayed. At the moment only fields from the CaseDateTimeTable can be displayed, but I would also like to display some fields from, for example, CaseTechInfoTable in that same subform.

But how?

When I create a (sub)form via the wizard and for example select:
CaseDateTimeTable - clientnumber
CaseDateTimeTable - Casenumber
CaseTechInfoTable - Problem description

and display these fields in the subform as a datasheet, then the separate cases from each customer are not displayed. I have 5 clients in my test dbase, just about all of them have 2 or 3 cases associated with them. In the example above only the data from two clients is displayed and then only from 1 case each, not the actual amount of cases. So for example:

clientnumber 4 has casenumber 5 and casenumber 6. But only casenumber 5 is displayed. The same happens for clientnumber 2, he has casenumbers 9 and 3 but only casenumber 9 is displayed.

The strange thing is though, that when I create the same (sub)form in datasheet view, but only use fields from the CaseDateTimeTable all cases per client are nicely displayed in the subform.

Why? And how do I solve this problem? I need to solve it so that I can add data from other tables into the subform later on so a nice overview of certain important data can be given per customer per case, even before the case form(s) is/are opened.

I've tried making a query and base a form on that, but for some reason I can't get the query to display all my customers, let alone all cases associated per customer. In the past I have made another (smaller and simpler) database for which I also made a lot of queries. But now? Pff... I'm lost at the moment.

Anyone?

View 1 Replies View Related

Deleting Multiple Tables Or Queries

Mar 6, 2007

Hi.

I have a cluttered database with too many 'no longer necessary' queries and tables.

Is there a way (other than deleting them one at a time) to delete multiple ones at once, as I can in My Documents, et cetera?

Russ

View 2 Replies View Related

Compare Data In Two Tables, With Multiple Conditions…..

Aug 25, 2005

Been trying to crack this one for a while hoping someone on here might be able to help me. ;)

I have a table with a list of required software and a table with a list of computers and the software installed software. I made a query that displays the machines with the required installed. My problem is if a machine has more than required then it does not display the record. If it needs Office, Photoshop but has office, Photoshop and quark installed then it does not display that machine.

This should be quite a simple thing, I have played with Like, NOT, Where and others but with no luck...

Any help would be greatly appreciated.

Graeme

View 2 Replies View Related

Data Entry Form - Multiple Tables?

Aug 18, 2006

I have been trying to figure this one out for a while and I can't seem to find anything helpful. I'm going to present a simplified version of my problem to help keep it simple.

I have an "Activities" table that contains fields:
ActivityID
ActivityName

I have a table of 7 Risk areas which contains fields:
RiskID
RiskName

What I need to do is to create a form that will allow the user to select an activity and then, for each of the 7 risk areas, input a risk measurement.

This involves the creation of a 3rd table to collect the user input which would contain fields:

MeasurementID
RiskMeasurement
ActivityID
RiskID

I can do a dropdown of the Activities and have a subform that links to it but the problem I'm having is trying to get that subform to list the 7 Risk Areas AND collect the RiskMeasurement information from the user. How can I have a listing of these 7 areas from one table that are tied to inputs that go into another table? This seems so basic and simple yet I have tried numerous things and all have failed.

I hope this was clear. Any help is appreciated.

View 14 Replies View Related

Data From Multiple Tables On Single Form

Oct 14, 2004

I have a tabbed form that contains multiple rows of data just like the following: (it's a service checklist for a store where the user makes choices from the combo boxes: e.g. good, fair, poor, etc)

Paint (txtHrs), Action (cboPaintAction), Condition (cboPaintCondition)
Carpet (txtCarpetHrs), Action (cboCarpetAction), Condition (cboCarpetCondition)
Counter (txtCounterHrs), Action (cboCounterAction), Condition (cboCounterCondition)
etc.

Since the combo boxes describe data that relates only to that element I can't put all the data needed into a single table. There are 40 of these rows so does that mean I have to create 40 tables? If so, how do I add the data to them from the form? Any help with this problem would be greatly appreciated!

View 2 Replies View Related

Merging Data From Multiple Tables Into One Via A Form

Nov 2, 2004

Hi all, I'm not an Access programmer by trade, but unfortunately got handed a project that nobody else wanted.

I have a small database taking shape which will track the auditing of paperwork/files. Each file has a unique ID associated with it, in this case, an account number. Audits will take place by selecting the job area (department), then the type of file (Line, Loan, Increase). This will be used to sort which type of audit questions are asked.

I have the following tables created:

tblQuestions: ID, Question, Product question applies to, Function question applies to, Comment field, and result field.
tblTeamMember: MemberID, TeamMember, Manager, PrimaryFunction
tblAuditResult: AuditID, MemberID, AccountNumber, Question, Result, Comment, Date of Audit
tblProduct: List of product types (line, loan, increase)
tblFunction: list of job functions

Currently a form is displayed so the manager can select the job function, then the file type. This will display:

frmAuditCreate - this form contains the fields: txtAccount, cmbManager, cmbTeamMember, txtAuditDate
Sub form on frmAuditCreate - frmQuestionSub - this form contains the fields: Question, Comment, Result

The frmQuestionSub is built off a query which uses the function and product values to determine which questions to filter and display.

Now, once the user is done flipping through each question in the sub form and input the data into the comment and result field associated with that question, I need that information along with the information on the frmAuditCreate to be stored in the table tblAuditResult. This is the problem I'm having difficulty with. I can't find a way to copy the question, comment, and result and insert it into the same record as the rest of the data.

Unfortunatlly I can't strip the database down enough to meet the 100k or less attachment limit.

View 8 Replies View Related

Data Input Form From Multiple Tables

Nov 4, 2004

Hi, I have a big problem. Here is the business rule, I am trying to track meeging request(MR) made. A meeting request is made by a manager,MR can include many analysts, and MR involves 1 project. I need to generate several reports from the MR information so I am trying to make sure the info is inputed correctly. I am trying to creat an input form for the MR table (tblMR) The input form is going to contain all the fields from the tblMR except the manager_ID and and the Project_ID, I am also going to have it track which analysts attended the meeting(1 or more). The problem I am having is in creating the form but having the analyst, manager, project values come from their own tables but after selecting them through combo box or list box, for values of Manager_ID and Project_ID to be entered in the tblMR. And for the analyst involved to be stored in a a composit table called tblMR-Analyst. this table will help me track how many meeting each analyst has been to. Any suggestions will help.

View 2 Replies View Related

Tables :: Merge Data - Multiple Rows To One Row?

Aug 29, 2014

I am trying to merge data from multiple rows into one row for each unique ID. I can replicate on how to do this on a table, maybe a query or something like that. Attached img shows

View 3 Replies View Related

General :: Comparing Data From Multiple Tables

Nov 5, 2013

We have an "item" table that contains information specific to an item (the item number is unique); and multiple "production line" tables. There is a relationship between the Items table and the Production Line tables (all 8 of them). Each item can be entered on 1 or more production line tables because one item may be produced on multiple lines and the settings vary based on the line they're produced. When entering an item in the Production table we MUST make a selection from the Item table.

Now, what I want to do is identify which item number(s) from the Items table does not have a specific field entry in ANY of the Production Line tables.

View 9 Replies View Related







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