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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to delete a record from Report but the record remain in the databa 2

Status
Not open for further replies.

hengsin

Technical User
Joined
Mar 26, 2003
Messages
128
Location
MY
I have one table with Action ID, Action Description and Action Status. Action ID is primary key, Action Description is Memo and Action Status is a combo box with 3 selection: Open, In Progress, Closed.

When a user choose the Action Status as Open or In Progress, you can see the action item on the Report. This part is pretty easy.

When a user choose the Action Status as Closed, the action item will be removed from the Report but remain inside the database. Can i know how to do that?
 
Set a filter on your report to show records where the Action Status is not closed.

One easy way to do this is have a button on a form to preview the report. In your form design view, if you create a command button with the wizard on, Access will walk you through the process of previewing a specific report.

Once you've created the button, right-click your mouse over it and select "Build Event". There should be a line of code that looks like the following:

DoCmd.OpenReport stDocName, acPreview

Change this line to

DoCmd.OpenReport stDocName, acPreview,,&quot;[ActionStatus]<>&quot;Closed&quot;&quot;


 
I think we're over-engineering the solution here....

Create a query, adding all of the table's fields into it (always run reports from queries people - not tables directly!). Under the Action Status field, add in a criteria of '<> closed' (quotes mine). Rune the query - just to check you have the right subset of data.

Now, just base your existing report on the query, instead of the table. Job done!.

As a general point - whilst sorting and grouping of data needs to be defined in the report, cutting down the data set should always be done in the query - it's easier, more flexible, and should you ever be working with really large data sets, the cut down in report processing time could be significant. </lecture> Jonathan Challis
IT Manager
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top