Comparing Fields Of Two Tables And Output To A Third

Jul 20, 2005

It has been a while since I last used Access, recently I've used mySQL and PHP.

First a little description of what I'm trying to accomplish:
I have three tables...

tblImport - has the fields: TestID(PK), i001, i002, i003, i004 ... i025
Note: i00# field contains the multiple choice answer (i.e. 1,2,3,4,5) as imported from a CSV file.

tblStudentAsr - has the fields TestID(PK), StudentID(PK), 001, 002, 003 ... 025.
Note: 00# containes the multiple choice answer (i.e. 1,2,3,4,5) as enterd by the student.

tblResult - TestID(PK), StudentID(PK), a001,a002, a003 ... a025.
Note: the fields a00# have the datatype set to "yes/no"

What I'm trying to do is compare the answers in tblImport to the answers in tblStudentAsr then output the result to tblResult .

Here is some dirty pseudocode:
if i001 = 001 then
INSERT 1 INTO tblResult
else
INSERT 0 INTO tblResult


The above example gets a little repetitive since I would have to do that for each question.
Is it possible to put the answer fields of each table into a recordset then compare them?
(I have heard that using rs's can be a little slow. Although there is only a max of 25 questions the number of students can be quite large)

Alternativly, can I accomplish this using only SQL statements?

What would be the best way to attack this?

Any suggestions (or alternate suggestions) would be greatly appreciated.

Thanks,

salmonman

View Replies


ADVERTISEMENT

Tables :: Truncated Output From One Table But Not Another - Long Text Fields

Oct 14, 2013

I have been using Access 2013 to make a database which outputs values to PowerPoint.

I have two tables with data in which are both brought together in a query which is the recordset my VBA code relates to to output it to Powerpoint. Both tables contain data in 'long text' fields. The data from one outputs into PowerPoint textboxes without any issues regardless of the length of the data but the data from the other one is truncated to 255 characters. It definitely says it is a 'long text' field - is there any reason it would truncate the output?

View 4 Replies View Related

Forms :: Adding Fields In A Table And Having Output Fill Fields On A Form

Jan 29, 2014

I have a totalquery that runs fine and give me the sum for both fields I'm looking for but I can't get the outputs to fill the fields on the form. I have tried the Dcount query in the control source but that just returns an error and locks up access.

Code:
SELECT [Tble-wcDelays].Causedby, Sum([Tble-wcDelays].HoursDelay) AS SumOfHoursDelay
FROM [Tble-wcDelays]
GROUP BY [Tble-wcDelays].Causedby, [Tble-wcDelays].LinkingID
HAVING ((([Tble-wcDelays].LinkingID)=[Forms]![Frm-ePlusCent]![cleanID]));

That is the query.

View 14 Replies View Related

Comparing Two Fields.

Dec 30, 2007

Hello,

I am a Beginner in MS Access and SQL and I need a query to compare two fields.

I am having two tables; T1 and T2, and I want to compare their
fields TF1 and TF2, and display the non matching fields in new
field.

Example:

Table T1
TF1

Location Louisville
Number 555345
Name Smith


Table T2
TF1

Location Louisville
Number 553450
Name Smythe


Thanks in Advance.:)

View 1 Replies View Related

Comparing Fields In Access

Apr 28, 2006

I have a database with a pre-surgery field and a post-surgery field. The use must enter the current procedure in the pre-field and then the actual surgery in the post field. I need to check to see if the fields match verbatim. The field is a memo field.

The users know how to copy and paste from the pre to the post fields. 90% of the time it is the same but not always.

Can anyone provide some help?

Thanks,
Deborah

View 2 Replies View Related

Comparing Two Fields In A Query?

Jun 18, 2007

I am trying to compare two different fields in the same query and return the most recent date in some another field. Would I be able to do this and if so how?

Any help would be greatly appreciated.

View 14 Replies View Related

Comparing 2 Fields--Looking For Differences

Jun 1, 2005

Hello,
I have 2 fields that are supposed to have the same information for each record. I got the information from different sources, which is the reason for having 2 fields. I wanted to make sure that the information was accurate. Turns out, that some of it isn't accurate--all the fields don't match.

Here's a little example of what I have:

|___TITLE___|___ISSN 1___|___ISSN 2___|
|__TITLE 1__|__12345678__|__12345678__|
|__Title 2__|__22224444__|__23224322__|
|__Title 3__|__98765432__|__98765432__|

As you can see, the ISSN numbers for Title 1 and 3 match. There's no problem there. I want a query that would list all those like Title 2, where the ISSN numbers don't match. Then I'd have a list of all of the problem Titles, and I could look up the real ISSN numbers.

Thanks

-Siena

View 2 Replies View Related

IIF Statement Comparing Two Fields?

Sep 28, 2012

The two tables are joined together by a primary and foreign key in the query, . I have not added the actual tables below , as data is senitive - i'm using an example. This join is made using the graphic relationship between the tables.

Table_1 with below column
Mode
6
6
6
6
6
4
4

Primary KEY
0001
0002
0003

[code]....

Initially the pseudo code i'm trying to get to work is;

if table_1.mode = 6 and table_2.type = 06 , then "MATCH" , else "NO_MATCH"

Expr1: IIf(IsNumeric([TABLE_2]![TYPE])="06" And IsNumeric([TABLE_1]![MODE])=6,"MATCH","NO_MATCH") ,

However this calculated field returns incorrect results, i.e. the query returns MATCH for rows that do not match , e.g. mode=6 and type=GL , Previously , when it was returning #Error when trying to match mode=6 and type=GL when it should ideally return "NO_MATCH", which is why I added Isnumeric.

Once I have sorted this out, I would like to achieve this as the calculated field

if table_1.mode = 6 and table_2.type = 06 , then "MATCH" , else "NO_MATCH" or if table_1.mode = 4 and table_2.type = 04 , then "MATCH" , else "NO_MATCH

how I can do this?

View 6 Replies View Related

Comparing Two Fields In One Criteria Field

Aug 9, 2005

Hi,
I just started doing something in access and need your help.
I have created a database and need to create a query which will sort all important fields within a certain time period. I have a date field and in the criteria field I wrote an expression:">Forms![Insert_date_form]![starting_date_field] and < Forms![insert_date_form]![ending_date_field]"

Its purpose is to show all fields which date is between this to dates. User will have to enter this dates in a separate form(Insert_date_form) which will store it in a small database containing only these two fields, e.g. generate report of all employees that are started working within a period between starting_date and a ending date. When I try to create and open a report based on this query I've been prompted with a small dialog which says: Enter parameter value.... for starting_date_field and same for ending_date_field. I don't need that. These dates are allready entered by user in a insert_date form and stored in its databese.

Is there a beter way to do this?

Thanks!
P.S. Sorry for my poor english. It's not my native language.

View 8 Replies View Related

Queries :: Comparing 2 Fields Query?

Mar 11, 2014

Trying to Compare 2 fields Status with answers Yes or No, from 2 Tables PipeLine and Pipe, and get the fields that don't match, what am i doing wrong?

SELECT PipeLine.[Project Name], PipeLine.[Capacity DC], PipeLine.[Project Num], PipeLine.[Status]
FROM PipeLine LEFT JOIN Pipe ON PipeLine.[Project Name] = Pipe.[Project Name]
WHERE (((Pipe.[Status]) ="Yes");

View 1 Replies View Related

General :: If Statement Comparing To Fields

Sep 27, 2012

query is refering to 2 tables

Table_1 with below column
Mode
6
6
6
6
6
4
4

Table_2 with below column

Type
06
GL
PL
04
16

Both tables are joined, and the pseudo code i'm trying to get to work is;

if table_1.mode = 6 and table_2.type = 06 , then "MATCH" , else "NO_MATCH"

I have tried below, but doesn't work.

Expr1: IIf(IsNumeric([TABLE_2]![TYPE])="06" And IsNumeric([TABLE_1]![MODE])=6,"MATCH","NO_MATCH") , returns incorrect results.

Ideally would like this

if table_1.mode = 6 and table_2.type = 06 , then "MATCH" , else "NO_MATCH"

or

if table_1.mode = 4 and table_2.type = 04 , then "MATCH" , else "NO_MATCH

View 6 Replies View Related

Forms :: Comparing Combo Box Value In Fields

Jun 26, 2013

I have form where some or more field exist. I want to compare two field as :

1. cboBatchID As Combo box
2. txtBillNum As Text Box

Private Sub cboBatchID_AfterUpdate()
If Me.cboBatchID.Column(4) <= 0 Then
Me.txtBillNum = 1
Else
Me.txtBillNum = CLng(Me.cboBatchID.Column(4)) + 1
End If
End Sub

I mean, if cboBatchID.Column(4) <=0 then txtBillNum start from 1 automatically or cboBatchID.Column(4) >=0 then txtBillNum = cboBatchID.Column(4)+1

I'm already trying with the code above. But does not work. Generate run time error.

View 14 Replies View Related

Comparing Two Fields With Identical Input Masks

Aug 31, 2007

I have a form control with the input mask on it for a phone number. I am using an append query to append the information entered in the form to a table. I need to pull two fields from a linked table from another database. What I need to do is be able to compare the entered phone number in the form with the phone number from the table. The problem I am running into is that it won't match the phone numbers. The same mask is used in the table I am pulling from. Why can I not just put =[Table].[Phone_No] in the Criteria of the field where the number from the form is placed so that I can get the right record from the linked table?

View 4 Replies View Related

Modules & VBA :: Comparing Two Multi Valued Fields

Jun 22, 2013

I have two fields in a table that have multiple values. Example:

Field A:

CT, CA, PA

Field B:

CT, CA

I want to compare the two fields and indicate that there is a match because in this example CT and CA are in both fields. I would like to create a function. I'm not sure if I would have to use something with like or create a loop.

View 5 Replies View Related

Output Data From Three Fields

Oct 15, 2007

I know I am being particularly stupid, but I can't work out how to do the following:
I have a table in which is recorded information about orders for customers. These fields are for orders of meat and poultry. As customers may wish to order more than one Turkey, I have created three fields called Turkey, Turkey 2, and Turkey 3. The data that is input is the weight of the Turkey e.g. 22 (lbs), 16 (lbs).

When it comes to ordering the turkeys, I need to produce a report which shows, by weight, the number of turkeys needed. This will need to add the number of turkeys in each of the 3 fields and order them by weight.

I've just got lost, trying to work out whether I base my report on the table or on a query based on the table. Help!!!

View 2 Replies View Related

Comparing Tables

Aug 17, 2006

I have two tables: -

1) Sales data
2) Claims data

I want to anaylse Premium (contained in the Sales Data Table) against Claims (contained in the Claims Data Table). The result I want to achieve is to show a loss ratio (Premium / Claims as a %). I need to show this on a per policy basis (each Table has a Policy Number Column).

Im new to Access and do not know how to go about this.

View 3 Replies View Related

Comparing Tables

Jul 12, 2005

Hi,

I have imported data from an ERP system into an Access table. This big table contains information about invoices processed last month. 2 of the columns are currency code and payment batch code.

Actually, there are rules that accountants should follow, but they can make errors. We would like to find those error using this Access database.

One rule is that only predefined payment batch codes should connect to a
currency code.

My idea was to create another table, where controllers are able to type in these rules like

EUR CIE
USD CIU
HUF BKH

This table has only 2 columns: currency code and payment batch code and no primary key has been defined.

The 2 tables were joined with the currency code and a query printed only those transactions where the payment batch code from the big table <> the payment batch code from the new table. This shows where accountants made an error.

This is the query:

SELECT [475 Master].*
FROM Tbl_Pmt_Btc INNER JOIN [475 Master] ON Tbl_Pmt_Btc.Cur_Code2 = [475 Master].Currency
WHERE ((([475 Master].Pmt)<>[Tbl_Pmt_Btc].[Pmt_Btc_Code]));

475 Master is the big table, Tbl_Pmt_Btc is the new table that can be modified by the controller.

This worked until more than one payment batch code were assigned to a currency code.

EUR CIE
EUR CIU

It seems that Access can use only one of them.

Can you please advise what to do in order that Access takes both rows into
account and the query prints those transactions booked in EUR where the payment batch code are neither CIE nor CIU.

Is there a simple solution without any programming?

Thanks,
Peter

View 2 Replies View Related

Need Help Comparing Tables

May 17, 2005

Hello - I am new to Access and don't know VB.

I am trying to compare 2 tables that each contain the following information:

Fields:
Document Number
Date
Changes (Amendments, etc.)

I would like to see the following on a report:

A - If a document number is on Table 2, but not on Table 1, show these on a "missing documents" report.
B - If a document number exists on both reports, however the dates do not match. Example: Document 123 is on Table 1 with a date of 1/1/1999 in the date field. Table 2 contains the same document in the document number field, however the date field contains 2/15/2005. SHow these on a "Date Differences" report.
C - If a document matches on number and date, however the changes field does not match.

Ultimately, I would like to add other fields to compare as well.

Hope this makes sense to someone out there!

Thanks!

View 1 Replies View Related

Comparing Two Tables.

Dec 24, 2007

Hi Guys,

I have made a database for a mobile phone retail store. The purpose of the database is to sort out network (e.g. Orange, AT&T) payments and compare them to our records. Our manager will enter in details into one table, including the different commisions that should be paid, plus the phone number. The other table is an imported spreadsheet that the commisions from the networks are shown. For each table, I have totalled the commisions.

My next step is to compare the two tables against the phone number, and commision totals, so that deals that have not been paid, or underpaid are highlighted. I know this involves a couple of loops, but my knowledge of Access does not go that far.

I have been thinking that I need to write code that gets one number in the first table and compare it against ALL records in the second table until it gets to the one with the same number, compare the values of commision total, and move on to the next record.

Can anyone help?

Cheers!

View 5 Replies View Related

Comparing Two Tables

Aug 22, 2011

I need to create a query that will compare both tables and just send out the records that dont match to a report.

Table1 asset#,Serial#
Table2 asset#,Serial#

query that checks that in Table1 the asset OR the Serial match the what is in Table2. and if it does not find a match to send it to a report.

View 11 Replies View Related

Comparing Tables/files

Feb 14, 2007

As part of my job I am constantly comparing files from a production environment against those from a UAT environment. The checks are generally the generic before I reconcile the monetary values I check that the static data population is the same. Basically I import the files into access and then do a like for like comparison on the number of blanks per field. Eg.

Field Blanks_UAT Blanks_Pro Diff
Coustomer_Number 10 2 8



Is there any way of doing this programmable so I can reuse it or are there any tools out there that do this work for me. Some of the files contain a large number of fields so the work can become rather cumbersome!

Any help is appreciated

View 3 Replies View Related

Comparing 2 Tables Of Data

Feb 28, 2007

Hi guys, i'll try and explain this as best i can....

I have 2 tables:

CurrentMonth
PreviousMonth

Both tables hold financial information by policy number. What i am doing is working out financial movement on a month on month basis. For example, if in previous month the financial position was £100 but in current month the finances had moved to £150 then the movement is £50 for the month. This i can do no problem by linking the tables by policy number and extracting the financial position and subtracting one from the other to give me a movement. However, in some instances there will be some policies that appeared in PreviousMonth but have since been cancelled back to policy inception so is not appearing in CurrentMonth.

Problem: I need to be able to bring in the policies on the previous month that are not appearing on the current month (due to cancellation).

Can anyone help me?

Cheers

View 1 Replies View Related

Query: Comparing Two Tables

Mar 22, 2006

I'm trying to write a report which initially I didnt think would be hard to do, but when it came time to write the underlying query I realized it was a bit above me.

I cant give away too much of the database structure here, due to legal issues, so sorry for being vauge. Hopefully I can give enough information that someone can get me started.

I have three tables that will be used in this query. One is called NAMES and has all of personal details of contacts. The only fields that are needed from this table are the primary key and citizenship field.

The other two tables are virtually the same, and they are the two being compared. One is REGISTRATION and the other APPLICATION. Essentially what I want here is to be able to compare the number of who applied to the number who actually registered.

Here are the pseudo-tables to give you a better picture:

NAMES
nID
FName
LName
DoB
Citizenship

REGISTERED
programCode
startDate
endDate
nID (foreign key)

APPLIED
programCode
startDate
endDate
nID (foreign key)

I've tried a few different approaches which worked in my head, but when it came time to run the query the results were different. Any suggestions on how I should tackle this?

View 3 Replies View Related

Comparing Two Tables In Msaccess

Apr 12, 2007

Is there any way to compare two tables and write out the records that don't match to a third table?


thank you.

View 1 Replies View Related

Comparing 4 Tables With A Query

Oct 13, 2004

I have 4 tables (one for each quarters data) each with the same fields:
Fund
FundFamily
Value

I have a query for each table that sums the values for each FundFamily (if there are multiple funds with the same FundFamily, it only shows the sum for the Family).

I am wanting a query that will show all of the different FundFamily fields from each table, but only once (say there is a Value in one quarter, but not the next). How is the best way to go about this?

Does what I'm trying to do here make sense?

-GorillaBoze

View 2 Replies View Related

Comparing 2 Tables Or Queries

Nov 8, 2004

I have 2 tables. Quotation Details and Order Details. As you fill in the Order details Form I wish to compare fields from the
Quotation Details Table. Is this possible? Please advise.
Thank you.

View 1 Replies View Related







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