Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetFocus to report 1

Status
Not open for further replies.

TSSTechie

Technical User
May 21, 2003
353
GB
Howdy

I have a form and a report open at the same time. I need the report to have focus when both objects are opened and, if a button is clicked on the form, it immediately passes the focus back to the report.

I think I should be OK with where to put the command to achieve this. The part i'm struggling with is what the command should be. I've tried
Code:
Reports!Report1.SetFocus
but this does nothing, no error but the form keeps focus [sad]

Has anyone got any ideas how I can achive this ?

Thanks in advance

TSSTechie

[lightsaber] May The Force Be With You [trooper] [yoda]
 
All you have to do is call the OpenReport action again - if the report is already open, it gets activated without re-querying its data.
Code:
Private Sub cmdFocusReport_Click()
  DoCmd.OpenReport "MyReport", acViewPreview
End Sub

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Howdy

Thanks a lot to both of you for replying. I actually went with VBslammer's method but that doesn't mean i'm not grateful to you HitechUser for offering your solution.

Thanks again

TSSTechie

[lightsaber] May The Force Be With You [trooper] [yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top