on_delete requery

S

SAC

When I delete a record I want to mark a control on the form which is bound
to the deleted (Y/N) field and then requery the data source and then move to
a new record.

The "deleted" record will still be in the table but will no longer show on
the form because the underlying query's criteria is set to on show records
who's deleted field is false.

Here's what's in the form's in_delete event:
txtDeleted = -1
DoCmd.Save
Forms![frmEstrh].Requery
Cancel = -1
DoCmd.GoToRecord , , acNewRec

I get an error that says "Operation not supported in transactions." How can
I make this work?

Thanks.
 
R

Rob Oldfield

Add another boolean field to the table... call it something like Active..
default value for normal records is true. Use a query for your form to only
include Active records and replace your pseudo delete code with just
changing the value to false.
 
S

SAC

Then, how do I only display the Active records without closing out the form
and reopening it?

Don't I need to requery the record source so only the Active records show?


Rob Oldfield said:
Add another boolean field to the table... call it something like Active..
default value for normal records is true. Use a query for your form to only
include Active records and replace your pseudo delete code with just
changing the value to false.


SAC said:
When I delete a record I want to mark a control on the form which is bound
to the deleted (Y/N) field and then requery the data source and then
move
to
a new record.

The "deleted" record will still be in the table but will no longer show on
the form because the underlying query's criteria is set to on show records
who's deleted field is false.

Here's what's in the form's in_delete event:
txtDeleted = -1
DoCmd.Save
Forms![frmEstrh].Requery
Cancel = -1
DoCmd.GoToRecord , , acNewRec

I get an error that says "Operation not supported in transactions." How can
I make this work?

Thanks.
 
R

Rob Oldfield

Yes. You'll need a requery.


SAC said:
Then, how do I only display the Active records without closing out the form
and reopening it?

Don't I need to requery the record source so only the Active records show?


Rob Oldfield said:
Add another boolean field to the table... call it something like Active..
default value for normal records is true. Use a query for your form to only
include Active records and replace your pseudo delete code with just
changing the value to false.


move
show
on
the form because the underlying query's criteria is set to on show records
who's deleted field is false.

Here's what's in the form's in_delete event:
txtDeleted = -1
DoCmd.Save
Forms![frmEstrh].Requery
Cancel = -1
DoCmd.GoToRecord , , acNewRec

I get an error that says "Operation not supported in transactions."
How
can
I make this work?

Thanks.
 
S

SAC

Thanks.

Rob Oldfield said:
Yes. You'll need a requery.


SAC said:
Then, how do I only display the Active records without closing out the form
and reopening it?

Don't I need to requery the record source so only the Active records show?


Rob Oldfield said:
Add another boolean field to the table... call it something like Active..
default value for normal records is true. Use a query for your form
to
only
include Active records and replace your pseudo delete code with just
changing the value to false.


When I delete a record I want to mark a control on the form which is bound
to the deleted (Y/N) field and then requery the data source and then move
to
a new record.

The "deleted" record will still be in the table but will no longer
show
on
the form because the underlying query's criteria is set to on show records
who's deleted field is false.

Here's what's in the form's in_delete event:
txtDeleted = -1
DoCmd.Save
Forms![frmEstrh].Requery
Cancel = -1
DoCmd.GoToRecord , , acNewRec

I get an error that says "Operation not supported in transactions." How
can
I make this work?

Thanks.
 

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