1

Topic: Removal of current record

Hello dear experts on Access. Help please.
I have a form with a source in the form of the table. The user adds records.
Records transit check on one of fields. If check is not transited, record needs to be deleted. It is current record.
Question - how to delete the current record, what command?
I know certainly that me. Recordset. Delete , but a trouble that only the first record is deleted well if the following record needs to be deleted too there is an error - "current record misses", and so all remaining.
Saw the help at a forum in the form of such line If Not Me. NewRecord Then DoCmd. RunCommand acCmdDeleteRecord
But sense it, alas, I do not understand, all properties NewRecord and acCmdDeleterecord

2

Re: Removal of current record

And how you delete? In sense, push any button on the form? Or how?
Personally I delete a command

CurrentDb. Execute "Delete FROM table WHERE of NomerZap =" Me! 

Yes, if at you the tape form it should be updated.

3

Re: Removal of current record

Joss;
No, removal  automatic if the user enters incorrect digit record is deleted entirely on event "After update" with a warning output. It would be desirable to update not so as throws out in the table beginning.
After all if hands record to delete, anything it is not required. The trouble that is visible access glorks those methods which I specified just such, but from the account, what record where, after performance me. Recordset. Delete

4

Re: Removal of current record

;
Certainly, I pass and it is explicit. The user if entered the incorrect data, lost record, enters another. That is further it is possible to work! But thus, if it again incorrectly enters, event tries to delete this record also. But already there is an error "current record misses"

5

Re: Removal of current record

MSerg1968-S wrote:

the User adds records.
Records transit check on one of fields. If check is not transited, record needs to be deleted. It is current record.

it is more logical to fulfill checks on Form_BeforeUpdate and "if check is not transited" - not to save.

6

Re: Removal of current record

Anatoly (Kiev);
And tell please, how not to save record? I understood a thought course, thought good, but what is a command not record savings? I did not know something such earlier? What it is necessary to write in event that record was not saved?

7

Re: Removal of current record

MSerg1968-S wrote:

how not to save record? I understood a thought course, thought good, but what is a command not record savings?

event BeforeUpdate has argument Cancel.
Assignment of any number not 0 leads to a saving canceling. Record remains on the screen. It it is possible to correct and save or refuse.
By the way, Cancel is and at other events.

8

Re: Removal of current record

MSerg1968-S wrote:

If check is not transited, record needs to be deleted

To do I will turn "on the fly" - then and to delete there is nothing it will not be necessary

9

Re: Removal of current record

bubucha;
As I will make it on the fly, at me and so all checks on events.
If I start new record to do, it during this moment and is formed also the user fills fields with the data. But during this moment in the table already (!) there is a record! And here suddenly on any field it enters malformed data and record it is necessary to delete. But after all it is already live record in the table, not virtual.

10

Re: Removal of current record

MSerg1968-S;
It is all it is already made to us (do not invent a bicycle) - check lead on event  fields and in a case not correspondences of the data cancel it, the cursor thus remains in the field and does not quit it while the field will not be cleared or into it do not enter the correct data - after all about it already spoke.
(personally to me would be very annoyingly because of one which I did not note, errors to lose record in shape from several tens fields)

11

Re: Removal of current record

, +1
MSerg1968-S, learn .
MSerg1968-S, for interest, a bookmark in the tape form. How to recover a cursor position after form update. here Esteem arguing.