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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would i prevent duplicate records in this senario...

Status
Not open for further replies.

markphsd

Programmer
Jun 24, 2002
758
US
I have a table that holds a range of dates. I use some code to insert all the dates in that range into another table. So for reference for this question, I'll call these tables tblScheduleDateRange and tblScheduleDates.

The problem is, the tblScheduleDates can have multiple records with the same date, and they are all attached to the same record in the tblScheduleDateRange. What I don't want is two records from the table tblScheduleDateRange, to have attached to them records with the same date from the table tblScheduleDates.

Since I feel that I'm having difficulty explaing this:

This is an example of what I don't want:

tblScheduleDateRange:
Field: ScheduleDateRangeID = 1
Field: ScheduleDateRangeBegin = 10/01/02
Field: ScheduleDateRangeEnd = 10/07/02

tblScheduleDateRange:
Field: ScheduleDateRangeID = 2
Field: ScheduleDateRangeBegin = 10/06/02
Field: ScheduleDateRangeEnd = 10/13/02

two tables, the dates overlap. They aren't duplicates, so the table scheme won't recognize that a schedule is overlapping.

What happens now:

tblScheduleDetailsDate:
Field: ScheduleDateRangeID = 1
Field: ScheduleDetailesDate = 2
Field: DetailsDate = 10/01/02
this would go through... 10/07/02

the next record set would be

Field: ScheduleDateRangeID = 2
Field: ScheduleDetailesDateID = 4
Field: DetailsDate = 10/06/02
this would go through... 10/13/02...

you can see how this duplicates the dates.. however, i do need duplicated dates. I just can't have duplicated dates between the ScheduleDetailesDateID's

If this isn't enough information, let me know. If doing a loop through the records would be the best solution let me know. The thing is, i just don't know how to do a loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top