Trying to set the focust to the report on top of all the open forms

J

jyo_palwai

Hi,

I tried to google a lot and failed to set the focus to the report . I
am running the report from the code.

I have a main switchboard and from that I navigate to several forms.
only one of these forms is open at a time.I select the criteria from
this form and run the report. My report is running but it is hiding
behind my main switchboard.

my code looks like the follwoing

Private Sub cmdRunReport_Click()
On Error Resume Next
DoCmd.OpenReport "rptNewCalibrationCards_Dept", acViewPreview
If err = 2501 Then
err.Clear
MsgBox "There is no Data for this Department.", vbOKOnly,
"Error Message"
Else
DoCmd.close acForm, "frmCalibrationCardsCriteria_Department"
Reports!rptNewCalibrationCards_Dept.SetFocus
End If
End Sub

And this is done in access 97

Am I doing anything wrong here. Any help is really appreciated.

Thanks,
Jyothsna
 
G

Guest

You can add a line of code to hide the main switchboard. Then display the
form when the report closes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top