UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> combine fields    
 
   
Jprogrammer
post May 17 2005, 10:15 AM
Post #1

UtterAccess Veteran
Posts: 394



I am trying to normalize a db that I have imported from an ODBC source. I have 2 sets of 6 different fields that I want to combine into 2 fields. Example of the current layout-

Employee ID Date 1 Rate 1 Date 2 Rate 2 Date 3 Rate 3 Date 4 Rate 4 Date 5 Rate 5 Date 6 Rate 6

This is what I want to acheive-

Employee ID Date Rate

I want all the dates in one field and all the rates in one field. What is the QUIKEST way to get this info the way I need it?

Thanks!!!
Go to the top of the page
 
+
AJS
post May 17 2005, 10:26 AM
Post #2

UtterAccess VIP
Posts: 3,893
From: Lansing, Michigan, USA



Create your table, then use a series of append queries to add the data to the table.
Change which Date and Rate fields are being appended with each query, making sure to exclude records where the date and rate field you are appending are null.

hope this helsp
-AJ
Go to the top of the page
 
+
Jprogrammer
post May 17 2005, 10:41 AM
Post #3

UtterAccess Veteran
Posts: 394



That does help! I don't have any experience with append queries but when I try to run it, I get an error message stating- "Duplicate output destination 'Employee'. Can you tell me what's that about???

INSERT INTO Normalization ( Employee, [Date], Rate )
SELECT ActiveEmpPR.[Active Employees].Employee, ActiveEmpPR.Pay_Rate_Date1_, ActiveEmpPR.Pay_Rate_1, *
FROM Normalization, ActiveEmpPR;

Thanks so much!
Go to the top of the page
 
+
fkegley
post May 17 2005, 11:54 AM
Post #4

UtterAccess VIP
Posts: 23,583
From: Mississippi



Look at your FROM clause. You are trying to append from Normalization TO Normalization. The field list does not include any fields from Normalization so all you need to do is change the FROM clause to:

FROM ActiveEmpPR;
Go to the top of the page
 
+
Jprogrammer
post May 17 2005, 12:25 PM
Post #5

UtterAccess Veteran
Posts: 394



THANK YOU! I can't believe I missed that...
Go to the top of the page
 
+
fkegley
post May 17 2005, 12:50 PM
Post #6

UtterAccess VIP
Posts: 23,583
From: Mississippi



You're welcome. Sometimes fresh eyes can see better.
Go to the top of the page
 
+
ScottGem
post May 17 2005, 12:53 PM
Post #7

UtterAccess VIP / UA Clown
Posts: 25,091
From: LI, NY



Also you should NOT use Date as a field name. Date is a reserved word in Access.

By the way, you are really combinng fields here. What you are doing is taking repeating groups and separating them into single records.
Go to the top of the page
 
+
Jprogrammer
post May 17 2005, 12:59 PM
Post #8

UtterAccess Veteran
Posts: 394



Now when I try to run the query I get an error msg saying "The INSERT INTO statement contains the following unknown field name: 'Pay_Rate_Date_2'. Make sure you typed the name corrrectly, and the try the operation again." I only want to pull Pay_Rate_Date1 and Pay_Rate_1 for the time being. Why is it asking me this?

Thanks to all of you for all of your help!



INSERT INTO Normalization ( ID, Change, Rate )
SELECT ActiveEmp_PR.Employee, ActiveEmp_PR.Pay_Rate_Date1_MMDDYYYY, ActiveEmp_PR.Pay_Rate_1, *
FROM ActiveEmp_PR;
Go to the top of the page
 
+
fkegley
post May 17 2005, 02:11 PM
Post #9

UtterAccess VIP
Posts: 23,583
From: Mississippi



The * at the end of the SELECT is causing it to get all the fields including those you have already gotten

Get rid of the * right now if not sooner!!!
Go to the top of the page
 
+
Jprogrammer
post May 18 2005, 09:21 AM
Post #10

UtterAccess Veteran
Posts: 394



Thanks!
Go to the top of the page
 
+
fkegley
post May 19 2005, 12:02 PM
Post #11

UtterAccess VIP
Posts: 23,583
From: Mississippi



You're welcome.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 03:27 PM