From: jnew on
Sorry about previous post. I hit Enter too quickly.

I have a subform based on a table with a "Deleted" field (data type:
Boolean). The underlying query criteria is Deleted=0.

I am trying to use the Delete event to set the "Deleted" field value to -1
and requery the form to subsequently hide the revised record. The requery
action fails, however.

Here is the code:

Private Sub Form_Delete(Cancel As Integer)
Cancel = True
Me.Deleted = -1
Me.DateDeleted = Now()
Me.Requery
End Sub

Any guidance will be greatly appreciated.


From: Dennis on
First, it appears to me that you are not actually DELETING a record. rather,
you are MARKING it as "deleted". So you wouldn't want to fire the
"Form_Delete" event. You'd want to use the "BeforeUpdate" event to set the
value of that column. Additionally, the query that underlies thr form needs
to have, as part of the SQL, " and Deleted = 0" in order to only pull records
whose Deleted column is FALSE. If you do these things, yor ReQuery should be
fine.

"jnew" wrote:

> Sorry about previous post. I hit Enter too quickly.
>
> I have a subform based on a table with a "Deleted" field (data type:
> Boolean). The underlying query criteria is Deleted=0.
>
> I am trying to use the Delete event to set the "Deleted" field value to -1
> and requery the form to subsequently hide the revised record. The requery
> action fails, however.
>
> Here is the code:
>
> Private Sub Form_Delete(Cancel As Integer)
> Cancel = True
> Me.Deleted = -1
> Me.DateDeleted = Now()
> Me.Requery
> End Sub
>
> Any guidance will be greatly appreciated.
>
>