473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Insert QRY results into existing table/records

Ok, here's another.........I've done it in the past, but am sick as dog right now and am not thinking properly..

I have an XLS that has the following info empUid, empStat, empPerf1, empPerf2, empPerf3.

The file gets emailed, updated then needs to be imported back into MDB table, respective fields.

Opening query, have the file linked, but I am completely forgetting how I inserted the information into the proper existing empUID (essentially updating their empty fields), rather than having it added to the end of the table?

PULLING MY LAST BITS OF HAIR OUT!
Jan 9 '09 #1
7 2488
Stewart Ross
2,545 Expert Mod 2GB
Hi. You could try the following update statement which updates the fields of the table joined to the Excel linked table. You must substitute in the correct names of your access table and your linked excel table as appropriate.

Expand|Select|Wrap|Line Numbers
  1. UPDATE     [your access table]       AS A 
  2. INNER JOIN [your linked excel table] AS E ON
  3.            A.EmpUID   = E.EmpUID
  4. SET        A.empStat  = E.empStat, 
  5.            A.empPerf1 = E.empPerf1, 
  6.            A.empPerf2 = E.empPerf2, 
  7.            A.empPerf3 = E.empPerf3;
-Stewart
Jan 9 '09 #2
Thanks Stewart!
Worked like a charm....
Now, one last "stupid" question......if, on the XLS, I would like to have "Employee Performance in Area 1" as the column heading, rather than empPerf1, is that possible?

You know, those outside....looking at the XLS need it to be pretty. :o)
Jan 12 '09 #3
Stewart Ross
2,545 Expert Mod 2GB
Hi Art. You can set the Excel headings in any suitable way, then refer to them in the update SQL like this:

Expand|Select|Wrap|Line Numbers
  1. A.empPerf1 = E.[Employee Performance in Area 1]
It is essential to use the left and right square brackets to enclose any field name that contains spaces.

-Stewart
Jan 12 '09 #4
Wooo-Hooo!
Worked like a charm!!!
Thanks and thanks to all that chimed in to help me out with this post.
:o)
Jan 13 '09 #5
So....like I said above, this worked beautifully.

Now I'm just wondering if there is a way to be prompted for the the source table at qry execution? Or is this something that needs to be built into a form?

Expand|Select|Wrap|Line Numbers
  1. UPDATE     [PROMPT FOR TABLE???]       AS A 
  2. INNER JOIN [your linked excel table] AS E ON
  3.            A.EmpUID   = E.EmpUID
  4. SET        A.empStat  = E.empStat, 
  5.            A.empPerf1 = E.empPerf1, 
  6.            A.empPerf2 = E.empPerf2, 
  7.            A.empPerf3 = E.empPerf3;
I'm thinking something along these lines.....

Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name
  2. FROM MSysObjects
  3. WHERE (((MSysObjects.Type)=1) AND ((MSysObjects.Name) Like "*tbl*")) OR (((MSysObjects.Type)=6) AND ((MSysObjects.Name) Not Like "*~TMPCLP*"))
  4. ORDER BY MSysObjects.Name;
  5.  
Jan 14 '09 #6
ChipR
1,287 Expert 1GB
Check out Everything About Using Parameters from Code. If you do this, you will probably want to make a form because the msg box asking for the parameter is so ugly and limited.
Jan 14 '09 #7
Thanks for all the help!
Worked beautifully using a form and the DoCmd :o)
Jan 23 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
7
by: Alex Vorobiev | last post by:
hi there, i am using sql server 7. below is the stored procedure that is giving me grief. its purpose it two-fold, depending on how it is called: either to return a pageset (based on page...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Andrew Bourne | last post by:
I would like to insert multiple records into a table based on a query returned from the same table. For example a datareader returns 3 records containing the following records user1 file1...
12
by: shank | last post by:
I'm trying to use online samples for submitting multiple records from ASP into a stored procedure. Failing! Through the below form, a user could be submitting many records at a time. I'm not...
11
by: Sezai YILMAZ | last post by:
Hello I need high throughput while inserting into PostgreSQL. Because of that I did some PostgreSQL insert performance tests. ------------------------------------------------------------ --...
3
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
2
by: mivey4 | last post by:
Okay I have 2 tables: Table A - holds a list of new hardware serial numbers and their corresponding model (no constraints or indexes) Table B - holds a distinct list of current serial numbers...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.