RE: Matching Type Query

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Jackson via AccessMonster.com" wrote:

> I've got two sets of data, financial information imported into access from
> two different sources. I basically want to check one version against the
> other. Problem is, there is no real way to uniquely identify them (that I
> know of). Table 1 has tons more information than table 2 which is more of a
> daily sheet of information.
>
> Fields include, two types of ccys (text), buy and sell amounts, trade dates,
> value dates and exchange rates but nothing that you could use as a unique
> identifier. Originally I was trying to put together a text string that used
> some of the info I've put down above ie USD/EUR 30/06/05 01/07/05 1.215
>
> And have that for each record as the unique identifier but it seems an
> inefficient and inaccurate way of doing it. Does anyone have any ideas for
> things like this, when you can't really get a primary key for the info but
> all records in one table do match records in the larger table?
>
> Cheers.
>
> --

What are you wanting to do? Delete matching records from one table? Link the
two tables?

How many fields would it take to determine that two records "matched"?

Does Table2 (the small one) have unique records? So that you could use
Table2 as the One side and Table 1 as the Many side?

What you might do is run a "find duplicate" query the small table (Table2)
using all fields in the record so you end up with unique records.

Add a new field of type Number - Long Integer , name it something like
"lngRec_ID". Use code to step thru the records and number each record. Do a
Compact & Repair.

Change the field type for the new field ("lngRec_ID" or whatever you named
it) to an Autonumber. Do a Compact & Repair.

Add a new field to Table1 of type Number - Long Integer. This will be the FK
that will hold the PK from Table2.

Again using code, compare every record in Table1 to each record in Table2
using however many fields necessary to determine if the records match or are
equal. If they are, save the Table2 "lngRec_ID" to the new field (the FK) in
Table1.

So if there are 100 records in Table2, you would go thru Table2 one time and
Table1 100 times.

When that is done. you could run a query to find any records in Table1 where
the new field Is Null.

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

.



Relevant Pages

  • Re: Tricky Visual Basic Code help...
    ... moves the current record into a new record in table2. ... this with a little VBA code and a couple custom queries. ... Set a "pushFlag" column in the record in table1 to a specific ... If a duplicate is not found, ...
    (microsoft.public.access.formscoding)
  • Re: Help needed with importing XML
    ... You could add a gratuitous identity column to #temp and use ... Those examples showed how to decompose arbitrary XML in multiple ... table1 and table2. ... But there has to be something in the relational schema tying table1 ...
    (microsoft.public.sqlserver.xml)
  • Re: 2 column pulldown
    ... Allen Browne - Microsoft MVP. ... these field heading names come from Table2 since it is a lookup and so ... Table1 of course only has a single column name ... fieldX from Table1 is pulldown revealing candidate values of Table2. ...
    (microsoft.public.access.forms)
  • Re: Sliding and page breaks
    ... but I still have one nagging formatting problem. ... each entry in table1. ... simply pulls the first match in table2 instead of showing all the ... Otherwise I was thinking along the lines of your 2nd suggestion of using some calcs to consolidate the data down to a smaller number of tables used in the layout. ...
    (comp.databases.filemaker)
  • Re: 2 column pulldown
    ... Allen Browne - Microsoft MVP. ... these field heading names come from Table2 since it is a lookup and so ... Table1 of course only has a single column name ... fieldX from Table1 is pulldown revealing candidate values of Table2. ...
    (microsoft.public.access.forms)