Addnew followed by Edit

M

MIG

I am using a DAO recordset to add a new record if fields don't match,
but to edit other fields if fields do match (using source data that's
sorted, so that all source records relating to the one record I am
adding to a different recordset are bunched together).

Basically, if I do an Addnew and subsequently do an Edit, will the
record I've just added always be my current record if don't do
anything else to move records, or do I need to find the record I've
just added?

Thanks.
 
M

ManningFan

After an Update statement, the table will reset itself. This means,
the Edit function will then start at the first row in the table and
edit that row. You will need to set a cursor or reset the recordset
to just the record you want to edit by using a WHERE clause in the
SELECT statement of the recordset.
 
M

MIG

After an Update statement, the table will reset itself.  This means,
the Edit function will then start at the first row in the table and
edit that row.  You will need to set a cursor or reset the recordset
to just the record you want to edit by using a WHERE clause in the
SELECT statement of the recordset.

Thanks; yes I found it not to work.

I did a seek on the table I was populating each time and that works
OK, ie if there's a no match, it adds the basic details to a new
record, but if there's a match it adds extra fields to the record it
just made. As long as the source recordset is sorted it seems to work
OK (the source has multiple records per person which I am having to
make into a flat record).
 

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