Urgent...Avoiding Dup Records in an Append
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 213   3
URL.หัวข้อ / URL
Urgent...Avoiding Dup Records in an Append

มีคนถามไว้ที่ 
http://www.quicktechusa.com/msgboard/wwwboard.pl?read=19924 
 
ตัวคำถามมีดังนี้ 
 
I have an attendance table that has no primary key but does have an index of SSN and program name. I have several counties that turn in a disk with their attendance table information. I have to append any new records as well as update old ones. I used the Unmatched Query wizard to create the query I needed to pull new records. It works fine as long as the student has no records in the main database table. My problem is if the student exists in the main attendance table with previous attendance months and has a record for a new month in the county's table. The query will not pull these records. I have tried everything I can think of, but nothing is working. It's the end of the quarter and I have to run reports using this table so any help will be greatly appreciated.  
 
The attendance table has SSN, program name, level, teacher id, quarter, attend mth, days of the month, monthly total and ytd total. All of this information needs to be appended. If the SSN in the county table is not in the main table at all, it needs to be added. If the county table has an SSN that is in the main table but the attend mth, teacher id or the program name is not in the main table, it needs to be added. To update a record, the SSN, program name, taecher id and attend month have to match. Then the daily, monthly and ytd totals would be updated.  
 
สรุปคำถามได้ดังนี้ 
 
 
ต้องการที่จะ Append ตารางจากภายนอกเข้ามายังตารางหลัก โดยมีหลักที่ว่า 
1. ถ้า SSN ในตารางใหม่ ไม่ซ้ำกับตารางหลัก ให้ Append เข้ามา 
2. ถ้า SNN ซ้ำ แต่ TeacherID, PgmName และ AttendMth ไม่ซ้ำ ก็ให้ Append เข้ามาเช่นกัน 
3. แต่ถ้า SNN, TeacherID, PgmName และ AttendMth ซ้ำ ให้ Update ข้อมูลกว่าด้วยตัวใหม่ 
 
 
เขาได้ส่งตัวอย่างตารางมาให้ 2 ตาราง โดยตารางหลักคือ Attendance และตารางที่จะนำเข้าคือ Attendance1 ตัวอย่างจริงอยู่ที่ http://agserver.kku.ac.th/basiceng/AttendDB_TimK.zip ครับ

3 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R00219
ขอบพระคุณ อ.สุภาพมากๆ ครับ สำหรับความรู้ดีๆ ครับ ไม่ทราบว่าหนังสือ Access ออกหรือยังครับ ผมสนใจ และอยากได้มากๆ ครับ ด้วยความเคารพ และนับถือ
2 @R00220
กำลังเร่งเหมือนกันครับ แต่งานที่รับไว้เขาก็เร่งกว่า ก็เลยทำให้การจัดทำหนังสือยังไม่ประติดประต่อเท่าไหร่ครับ ชอบคุณที่ให้กำลังใจอุดหนุน
3 @R00221
มีปัญหากับการโพสท์วันที่ครับ แต่ตอนนี้แก้ให้แล้ว
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0815s