So when I open a database a main form appears (like a switchboard). I have buttons which take me to several other forms (for multiple uses). There's a form which has buttons that are supposed to open queries and reports. Herem I'm using the following code to open a report.
Private Sub cmdFullTimersR_Click()
DoCmd.SelectObject acReport, Me.Name
DoCmd.Minimize
DoCmd.OpenReport "Full Timer - Current Month", acViewNormal, , , acWindowNormal
End Sub
The form is named "Audit Tool Summary". However when I click the button the code errors out saying: 'The object 'Audit Tool Summary' isn't open.
I'm confused. I have used the same code to open queries (which open in a form) through buttons on the same form. There it works. But I don't understand why opening a report is a problem. A sample code for opening a form through the same process is below:
Private Sub cmdColl_Click()
DoCmd.SelectObject acForm, Me.Name
DoCmd.Minimize
DoCmd.OpenForm "Variable Coll - Current Month", acNormal, , , acFormReadOnly, acDialog
End Sub
Btw, I have designed the database such that there is just one form open at any point. When you click a button to open a form etc. the active window minimizes and the new window opens. I'm trying to keep the same trend going with reports...
Is there a different approach to opening reports? Please help
Private Sub cmdFullTimersR_Click()
DoCmd.SelectObject acReport, Me.Name
DoCmd.Minimize
DoCmd.OpenReport "Full Timer - Current Month", acViewNormal, , , acWindowNormal
End Sub
The form is named "Audit Tool Summary". However when I click the button the code errors out saying: 'The object 'Audit Tool Summary' isn't open.
I'm confused. I have used the same code to open queries (which open in a form) through buttons on the same form. There it works. But I don't understand why opening a report is a problem. A sample code for opening a form through the same process is below:
Private Sub cmdColl_Click()
DoCmd.SelectObject acForm, Me.Name
DoCmd.Minimize
DoCmd.OpenForm "Variable Coll - Current Month", acNormal, , , acFormReadOnly, acDialog
End Sub
Btw, I have designed the database such that there is just one form open at any point. When you click a button to open a form etc. the active window minimizes and the new window opens. I'm trying to keep the same trend going with reports...
Is there a different approach to opening reports? Please help
