Re: splitting excel spreadsheet fields into multiple tables

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



Hi Ryan,

You need to use a query rather than working through the existing form.
The idea is to create a query that joins the imported table of expenses
(let's call it Imp) to the existing Employees table on the employee
name, returning EmployeeID and the expense fields from Imp. Then use
this as the source of an Append query that appends the new records to
the existing Expenses table.

Things can get complicated if (as is often the case) the names in the
Excel sheet don't exactly match the names in the Employees table.

You mention "EmployeeName" in the former and "First_Name", "Last_Name"
in the latter. If EmployeeName is of the form "Smith, John" then you
could join them with an query like this:

SELECT Employees.EmployeeID, Imp.AAA, Imp.BBB, ...
FROM Employees INNER JOIN Imp
ON Employees.LastName & ", "
& Employees.FirstName = Imp.EmployeeName
;

where AAA, BBB, ... are the fieldnames in the Imp table.

But watch out for problems with mis-typed names, names shared by two or
more people, and so on.

On Wed, 9 Aug 2006 13:34:09 -0700, InternRyan
<InternRyan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I have a table in my db for employees that has First_Name, Last_Name and
EmployeeID fields. I have an expenses table that has the details for the
expenses but only the EmployeeID.

I imported an excel spreadsheet which is now a table with EmployeeName, and
the details I need for the expenses table.. I have a form which matches the
imported spreadsheet. It has an not-in-list event add feature so I thought I
would be able to cut and past from one to the other. This actually works
perfectly line for line but not for multiple lines.. is there a way to
automate it to do it line by line or does anyone know why this isn't
working.....

Thank you,
Ryan

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.



Relevant Pages

  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • Re: OT: SQL
    ... said was a totally failed attempt to formalize and automate database ... query processing. ... create table Employees ... Manager and Employee Salaries. ...
    (sci.logic)
  • Re: query a number stored as text
    ... Your query is quite complex, ... I need to join the Employees table to the Orders table like so ... ... "Lee" wrote in message ... >> GlobalSign digital certificate is a forgery and should be deleted without ...
    (microsoft.public.access.queries)
  • Re: OT: SQL
    ... said was a totally failed attempt to formalize and automate database ... query processing. ... create table Employees ... Manager and Employee Salaries. ...
    (sci.logic)
  • Re: Multi-Value Field Query
    ... It was directed at what Microsoft calls a Multi-Valued field, which is not the same as what you have ... This doesn't work very well in the query interface in Access, so you probably need to write a VBA function that does this for you. ... three areas 'CreatedBy', 'Owner', 'Employees'. ... appropriately and it lists all employees involved ...
    (microsoft.public.access.queries)