H
hughess7
Hi all
I have some code which creates dates in a related table, snippet below:
NoOfDays = Forms![frm Itinerary]![Itinerary].Form![ReviewDays] - 1
StartDate = Forms![frm Itinerary]![Itinerary].Form![ReviewDate]
ItinID = Forms![frm Itinerary]![Itinerary].Form![ItineraryID]
dtmDate = StartDate
For n = 1 To NoOfDays
dtmDate = DateAdd("d", 1, dtmDate)
strSQL = "INSERT INTO [Itinerary Dates]([ItineraryID],[ReviewDates])" & _
"VALUES(" & ItinID & ", #" & Format(dtmDate, "mm/dd/yyyy") & "#)"
It takes the ItineraryID and StartDate and increments the dates based on
NoOfDays. This works well, but if the number of days changes, I would like to
check to see if any date records already exist and prompt user to delete them
if so.
What is the best way to do this?
Thanks, Sue
I have some code which creates dates in a related table, snippet below:
NoOfDays = Forms![frm Itinerary]![Itinerary].Form![ReviewDays] - 1
StartDate = Forms![frm Itinerary]![Itinerary].Form![ReviewDate]
ItinID = Forms![frm Itinerary]![Itinerary].Form![ItineraryID]
dtmDate = StartDate
For n = 1 To NoOfDays
dtmDate = DateAdd("d", 1, dtmDate)
strSQL = "INSERT INTO [Itinerary Dates]([ItineraryID],[ReviewDates])" & _
"VALUES(" & ItinID & ", #" & Format(dtmDate, "mm/dd/yyyy") & "#)"
It takes the ItineraryID and StartDate and increments the dates based on
NoOfDays. This works well, but if the number of days changes, I would like to
check to see if any date records already exist and prompt user to delete them
if so.
What is the best way to do this?
Thanks, Sue