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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening report using form button and VBA

Status
Not open for further replies.

thames11

Technical User
Feb 10, 2007
7
0
0
GB
Hi,

I have 8 buttons on a form. Each one opens a report using VBA.

e.g

Private Sub Command43_Click()
On Error GoTo Err_Command43_Click

Dim stDocName As String

stDocName = "ordergeneralreport"
DoCmd.OpenReport stDocName, acPreview

Exit_Command43_Click:
Exit Sub

Err_Command43_Click:
MsgBox Err.Description
Resume Exit_Command43_Click

End Sub

The report is based on a query. Intermittently, some of the buttons do nothing when clicked. Then I click on another of the buttons and all of the buttons start working again - and the cycle continues. Any suggestions as to what is causing this?

Regards

Simon.
 
Have you any code associated with this form that locks or disables anything?
 
Do you have anything that moves the focus away from the form so therefore when you click the button you are actually first enabling form as the mian focus and after this point would accept a click.

is your forms title bar blue or greyed.. (or somethign different than active)

R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top