Windows XP MS Acess qurey results into report

Joined
Oct 31, 2008
Messages
1
Reaction score
0
I am trying to generate a report on a query result from a search form. I would like a report of the results to be generated when I hit the "Command179" button on the serch form. The following is programmed to the "Command179 button":

Private Sub Command179_Click()
On Error GoTo Err_Command179_Click
Dim stDocName As String
stDocName = "rptadvsearch1111"
DoCmd.OpenReport stDocName, acPreview, , , , Me.Name
Exit_Command179_Click:
Exit Sub
Err_Command179_Click:
MsgBox Err.Description
Resume Exit_Command179_Click
End Sub

The following is programmed to the on open and on close of the report:

Option Compare Database
Option Explicit
Private Sub Report_Close()
Forms(OpenArgs).Visible = True
End Sub

'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'DoCmd.Close acForm, OpenArgs
'End Sub

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = ""
Me.RecordSource = Forms(OpenArgs).prpSQL
Forms(OpenArgs).Visible = False
End Sub
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
End Sub

When I hit the "Command179" button the debug points to Me.RecordSource = Forms(OpenArgs).prpSQL.

I used the report wizard to create the report.

Please help :)
 

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