Originally Posted by
Halocarbon
I am making a database in which my users will add data to a form then they
will click a command button that runs a macro to view the information on a
report. How can I get the form to hide while they are viewing the report. I
did this in Access 97 with the send keys function and using "%W"h, then
opening the report. But in Access 2000 this does not work. Any ideas? I have
sort of fixed it by having two separate send keys functions; one to press %,
and the other to press wh. But sometimes this works and sometimes it doesn't.
Anyone know why?
Try this, updating as needed to fit your object names. The code goes in the code module for the report.
Code:
Private Sub Report_Close()
Dim frm As Form
On Error Resume Next
Set frm = Forms("frmReports")
If Err = 0 Then frm.Visible = True
On Error GoTo 0
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim frm As Form
On Error Resume Next
Set frm = Forms("frmReports")
If Err = 0 Then frm.Visible = False
On Error GoTo 0
End Sub