skip to Main Content

I am trying to import a CSV file exported from Ebay into MS Access.

Ebay cram into one file what should be in two files. So if someone purchases two products, Ebay puts the customer details in one row and the products bought in the following lines.

Screen shot of CSV file

Customer cruze130613 bought two products, so has information spread over three lines!

What I would like to do is fill the empty User ID column blanks.

So:

Set [User ID] equal same 'User ID' as where [Sales record number] = [Sales record number]

I think the select clause for [Sales record number] should use DISTINCT as is duplicated on >1 rows.

Any help with the SQL code will be appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    Thank you Lee for your suggestion.

    As far as I can see Ebay only export these pseudo CSV files.

    I had another look today and managed to find a solution. I wonder which would be more efficient yours or mine?

    UPDATE tEbImportRaw AS eir1
    INNER JOIN tEbImportRaw AS eir2
    ON eir1.[Sales Record Number] = eir2.[Sales Record Number]
    SET eir1.[User ID] = eir2.[User ID];
    

  2. Perhaps something along the lines of the following:

    update YourTable t1 
    set t1.[user id] = dlookup
    (
        "[user id]",
        "YourTable",
        "[user id] is not null and [sales record number]=" & t1.[sales record number]
    )
    where t1.[user id] is null
    

    Change both references of YourTable to the name of your table.

    Here, the domain aggregate function DLookup is used to acquire the value of the User ID field for a record meeting the supplied criteria (in this case where User ID is not null, and where the sales record number is equal to that of the record being updated).

    There are other ways to achieve the same result, but DLookup is used here to retain the ‘updateability’ of the query in MS Access.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search