Does anyone know the magic trick to make the Format event fire for a report section? I have a simple event procedure linked to the On Format property of the Detail section, but it doesn't work.
learn.microsoft .com assures me "For report detail sections, the Format event occurs for each record in the section just before Microsoft Access formats the data in the record"; but setting a breakpoint confirms that in my case the event procedure never gets called. Is there something else I need to do?
I have tried the usual - close/reboot/reopen, compact and repair, decompile and recompile, copy all controls to a brand new report - all to no avail.
I will insert the procedure code below for completeness, but since it is never invoked I doubt that the content of the procedure has any bearing of the problem.
Please ignore the ectopic spaces above; they were inserted by Post.Bytes - they are definitely not there in my original code.
learn.microsoft .com assures me "For report detail sections, the Format event occurs for each record in the section just before Microsoft Access formats the data in the record"; but setting a breakpoint confirms that in my case the event procedure never gets called. Is there something else I need to do?
I have tried the usual - close/reboot/reopen, compact and repair, decompile and recompile, copy all controls to a brand new report - all to no avail.
I will insert the procedure code below for completeness, but since it is never invoked I doubt that the content of the procedure has any bearing of the problem.
Code:
Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer) ' ' If the pilgrim withdrew during the event, add an extra line to say so. ' Dim tpcm As Variant tpcm = 1440 / 2.54 ' twips per centimetre On Error GoTo ErrorProc If txt.Response = "W" Then lblWithdrawalNote.Caption = "NB: " & "[First_name]" & " attended initially, but withdrew during the event." lblWithdrawalNote.Visible = True Me.Detail.height = 1.8 * tpcm ' Set section height to 1.8cm for this record only Else lblWithdrawalNote.Visible = False Me.Detail.height = 1.2 * tpcm ' Set section height back to 1.2cm for other records End If ByeBye: Exit Sub ErrorProc: MsgBox "Error " & Err.Number & " - " & Err.Description , , "Error closing F52" Resume ByeBye End Sub
Comment