Search and delete records

H

hughess7

Hi all

I have two continuous subforms both sat on a blank parent form. If a record
is entered (subform1) with days greater than 1, the remainder dates are
populated into a related date table (on subform2) using the StartDate
(ignoring Sunday's).

I have the code working to add the dates.

If the user changes the number of days of the activity, I want the system to
update the related dates. The simplest way I could think of doing this was to
delete any if they exist and recreate the dates again.

What would be the best way to do this?

Use dlookup or dcount matching on the key (SpecID and ReviewDates) then
CurrentDB.Execute "DELETE * FROM to delete them?

Thanks in advance for any help.
Sue
 
H

hughess7

Sorry I thought I had explained it ok, the two subforms are side by side and
both continuous forms hence they reside on a blank main form. I have the
links working so that when a record is added in subform1 it requeries
subform2 to keep in sync, subform2 has its child and master fields linked to
subform1.

suform1 is based on Table 'Plan' and has its primary key of SpecID and
ReviewDate, subform2 is based on Table 'Plan Dates' which has the key
'ReviewDate' and 'SpecID' and 'ReviewDates'. ReviewDates holds the extra
dates of the activity.

To give you an example:

Table: Plan

SpecID = 1, ReviewDate = 01/07/08, ReviewDays = 4

Table: Plan Dates

SpecID = 1, ReviewDate = 01/07/08, ReviewDates = 02/07/08
SpecID = 1, ReviewDate = 01/07/08, ReviewDates = 03/07/08
SpecID = 1, ReviewDate = 01/07/08, ReviewDates = 04/07/08

Hope this makes more sense?

Thanks
Sue
 
J

Jeff Boyce

I'm not exactly clear from your description, but it sounds like you have
subforms on a main form, but are NOT using the automatic main form/subform
coordination that Access offers.

It all starts with the data -- if you'll describe a bit more about your
underlying data structure, folks here may be able to offer more specific
suggestions.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top