| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 80701 | 2007-07-02 09:29:00 | MS Access - Report question | Tagoso (12361) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 565119 | 2007-07-02 09:29:00 | HI there, I have a timesheet report - which is a list of people and the number of hours they worked each day - and at which location. For a summary version, I want the total hours for each person to be correct, but I only want the detail lines (date, hours and location) to show if the location begins with the letter 'z'. How can I supress or hide detail lines dependant on the value of one of the fields? I can hide all of the details by making that section not visible. Using Left() I can determine which location starts with 'z', but I can't work out how to 'supress if'. Not sure if I have explained myself well - but any help would be appreciated. Cheers, Bryan |
Tagoso (12361) | ||
| 565120 | 2007-07-02 13:13:00 | Hi Bryan Add the following VBA code to the report: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If UCase(Left$(Me.MyLocationField, 1)) <> "Z" Then Me.Detail.Visible = False Else Me.Detail.Visible = True End If End Sub Open the report in design view, right click the detail section of the report > properties > 'event' tab > 'on format' property > click the 3 dots to the right > Code Builder > Ok > copy and paste the code. Make sure you use your actual field name in place of 'MyLocationField'. Andrew |
andrew93 (249) | ||
| 565121 | 2007-07-03 05:08:00 | You should be able to manually edit a query. I know next to nothing about Access but use other databases. Can you find and post the SQL code for your query? You can very simply add conditions to a SQL query by adding a clause like this to the end: WHERE location LIKE "z%" Again, I know nothing about Access and wouldn't touch it with a barge pole myself. It may not even support LIKE. |
TGoddard (7263) | ||
| 565122 | 2007-07-04 08:28:00 | Using criteria in a query will restrict the records that are available to the report. The OP indicated they wanted to hide the detailed records on the report, but still wanted the summary values - so I don't think your suggestion, as it currently stands, will work. Again, I know nothing about Access and wouldn't touch it with a barge pole myself. I'm curious - why not? It may not even support LIKE. It does. |
andrew93 (249) | ||
| 1 | |||||