Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Question

Status
Not open for further replies.

metalteck

MIS
May 10, 2006
54
US
I have a database and a spreadsheet.
The spreadsheet contains a customer list. I need to make a report with other data.
This data comes from the database.

I have imported the spreadsheet into the database as a table.

I link the first and last name to eachother and run the new query.
I get various duplicates. The only other field I can think of linking is the purchase date. The only problem is that the purchase date is written as, 4/18/2006 in the spreadsheet, and the database has 3 different tables for the date, ex. date1=month, date2=day, date3=year.

Other than manually looking up each account, is there a way I can make my search easier?

Here is my code:

SELECT BSYDTAA_BADPLPP.[LPMRC#], Sheet1.LASTNAME, Sheet1.FIRSTNAME, Sheet1.DOB, BSYDTAA_BSYMQTPS.QTPSD, Sheet1.DOS
FROM (BSYDTAA_BADPLPP INNER JOIN Sheet1 ON (BSYDTAA_BADPLPP.LPPFNM = Sheet1.FIRSTNAME) AND (BSYDTAA_BADPLPP.LPPLNM = Sheet1.LASTNAME)) INNER JOIN BSYDTAA_BSYMQTPS ON (BSYDTAA_BADPLPP.LPPSRC = BSYDTAA_BSYMQTPS.QTKEY) AND (BSYDTAA_BADPLPP.[LPHSP#] = BSYDTAA_BSYMQTPS.[QTHSP#]);
 
I have imported the spreadsheet into the database as a table.
I link the first and last name to eachother and run the new query. I get various duplicates."

Yeah. You can't import a spreadsheet into, I assume, Access and then just stop. You have to Normalize the table. The end result is usually more than one table and NO duplicates. And why the other database table has three different fields for the date is beyond me. You could concatenate the date fields (date1 & "/" & date2 & "/" & date3) so then you'd be comparing the dates straight up.

Maybe someone else can help you but until the database is actually constructed correctly, and future work is a waste of time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top