Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep same data on form when delete

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
I have a form that contains a button to delete a record. When the button is click the information in the form is blank or the information in the form change to blank form.

Is there anyway that I can keep the information on the form displaying the record that is going to be delete.

Guidance and collaboratio with this question is appreciated.

Luis
 
Please post the code that deletes the record.
 
The code to delete the record is;
Private Sub cmdDeleteCategory_Click()
On Error GoTo Err_cmdDeleteCategory_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_cmdDeleteCategory_Click:
Exit Sub

Err_cmdDeleteCategory_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteCategory_Click

End Sub
 
How about marking the record deleted rather than actually deleting it?

Say:

[tt]Me.DelDate=Now[/tt]

The record source of the form would be:

[tt]Select Id, Blah From tblTable Where DelDate Is Null[/tt]

This way, records will remain until there are actually deleted by an administrator and the form will show the record until it is requeried.

As an aside, unless you are using an old version of Access (97 or earlier), you should use:

[tt]DoCmd.RunCommand accmdDeleteRecord[/tt]

Instead of the code generated by the Wizard.
 
Thank you for the feedback however I don't understand what you are asking me to do. I tried what you asked me but get that the delete command is not available.

Luis
 
When you say you tried what I asked, do you mean the bit that says "As an aside"? If so, that is a comment on wizard generated code and not a suggestion to fix your problem. You will find more comments on wizard generated code here:

My suggestion is that you include a field in your table that allows you to mark a record as deleted, rather than really deleting it. Is this something that would work for you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top