Result sort - join with VBA...

  • Thread starter Thread starter VilMarci
  • Start date Start date
V

VilMarci

Hi,

I started at the qureies topic but as I was afraid of, only VBA left.
Can anyone give me an idea how to start?

I need to join anyhow these two table mentioned below.

The two source table look like:

Table1
key,orderNumber,PossibleSN
1,11,123
2,11,
3,12,345

Table2
OrderNumber,SentSerial
11,123
11,321
12,345

So what I need is a result like:
key,orderNumber,PossibleSN,SentSerial
1,11,123,123
2,11,,321
3,12,345
 
VilMarci,

This is not related to macros.

I don't see how what you are asking is possible. I assume you made an
error in typing the last row of your "what I need", and it should be:
3,12,345,345
If so, I think I understand what you are on about. But in order to
reliably produce the results you want, you would need to be able to
identify which Table2 record corresponds with which Table1 record. This
does not seem to be the case at the moment. In your example, there are
2 records in both tables for OrderNumber 11, and you have extrapolated
from the first row in Table1 to the first row of Table2, and from the
second row of Table1 to the second row of Table2. Which is all fine and
dandy from an intuitive point of view. But from a database point of
view, this is impossible, either using query or VBA. If you had a field
in Table2 that corresponds with the Key field in Table1, then we might
be able to do something.
 
Hi,

Yes, it was a mistype.
If I had a common key, I wouldn't post it to the newsgroup :)

Now what I'm thinkink is like.

Creating a table with the "duplicate" records.
Removing recrods I do not need with VBA.

Like:
I know that
First I need to check if have matches:
record 1,11,123,123 is correct, because the serials match.
When I found, I can remove all records referring to serial 123 because I
used the serial 123 once.

If no matches found, then keep the first, delete the rest.

Do you have an idea how to do this if possible?

Thanks,
Marton
 
Back
Top