Search form for Report Problems

irishblue

Registered User.
Local time
Yesterday, 17:48
Joined
Jul 14, 2005
Messages
25
I am still working my way up the Access moutian. I am working on a project that lets users search the database for a number of different items, which will then generate a report. I just cannot figure it out. I tried this code that developed a dialog box, but I get the runtime error 2585. The debug sends me to the line that I've labeled with a sad face.

Option Compare Database

Private Sub Command8_Click()
Me.Visible = False
DoCmd.OpenReport "Productivity", , , , acDialog :confused:
DoCmd.Close acForm, "Report Filter"
End Sub
Private Sub Cancel_Click()
DoCmd.Close
End Sub
Private Sub Command9_Click()
DoCmd.Close 'Close Form
End Sub

Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Productivity Report only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub

Private Sub OK_Click()
Me.Visible = False
End Sub

I am new to this and any help to learn that I could get would be great.
 
Last edited:
Try

DoCmd.OpenReport "Productivity", acViewPreview
 
I ended up going a different route with it, but thank you for the relpy
 

Users who are viewing this thread

Back
Top Bottom