Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Oct 24, 2022
Solved

Close Button on Report - Set Focus but doesnt close report

Hello Experts,   I have a report that opens and on load I set the focus to the close button on the report.  I want to be able to hit the enter key and close the report and although the button's foc...
  • arnel_gp's avatar
    Oct 25, 2022
    is your Report in Report View?
    i think it is.
    bring it again in design view.
    on the Report Property Sheet->Event->Key Preview: Yes.
    now add code to the Keypress event of the Form:

    Private Sub Report_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    Call yourCommandButton_Click
    End If
    End Sub

Resources