#Deleted

S

swas

Hello,

I have a continuous form where the rs is from a main table, and one currency
field from a detail table.

If data is entered into the detail table field, the info is entered
correctly, along with a few other default field values not displayed.

My problem is, if the detail record has a value, and the user overwrites
with $0 or clears the field, I wish to delete the child record. I am doing
this with a runsql delete.

All this is fine, but I then get a #Deleted displayed on my form. Me.requery
fixes the problem but also makes the first record the current record, and
this is too confusing for the user.

Is there any other way of clearing the #Deleted? My only other thought is to
run the delete query when the form is closed, to tidy up the table, or turn
echo off, find the record again, b ut then the user tab position is also lost
- and starting to make a simple action complex...


Thanks in advance


swas
 
D

Daryl S

swas -

What would you like to happen? If you want the user to be on, say, the
record that was after the deleted record, then you can can store the current
record number in a variable, then requery, and then move to the record you
want based on the saved record number. This only works if the record source
is sorted (order by). You will also have to test for the number of records
in the new recordset in case they deleted the last record, in which case you
can set them to the new last record (one before the old deleted record).

The other option is to delete the record through the form, which will handle
the requery for you. That would depend on your business rules - you may have
a good reason to delete the data through SQL.
 

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