Alternative to Passing OpenArgs in OpenReport

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I think the syntax for OpenReport method in 2003 is something like:
DoCmd.OpenReport reportname [, view] [, filtername] [, wherecondition] [,
window-mode] [, openargs]
Now, that is not the syntax for it in 2000, which is:
DoCmd.OpenReport reportnmae [, view] [, filtername] [, wherecondition]

I want to convert coding in 2003 that checks for the status of a checkbox
control (call it chkDetails) and passes it through the OpenReport method to
open a report in preview either showing details or not depending on checkbox
status

I have a button on a form which the user clicks to open the report

The relevant code in 2003 is

DoCmd.OpenReport "Report", acViewPreview, , , , chkDetail

I need an alternative way of handling the check box control in 2000 so if it
is checked (it's default value is set to -1 so it is pre-checked), the report
will open showing a details section ... the Report design code contains

Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
Reports("Report").Section(acDetail).Visible = Me.OpenArgs
End Sub

Can I do this with some If...Then statement in 2000?
 
For 2000, you will need to put the code in the Open event of the report and
have it reference the check box.
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
Reports("Report").Section(acDetail).Visible = forms!MyFormName.chkDetail
End Sub
 
Thanks for your reply, I sort of figured it out. What I did was remove the
chkDetail openargs argument from the form the cmdOpenReport_click sub
procedure, essentially leaving it DoCmd.OpenReport "Report", acViewPreview

Then in the actual Report Open code section I did this:

Private Sub Report_Open(Cancel As Integer)
Dim varValue As Boolean
DoCmd.Maximize
If Forms.ReportSetup.chkDetail = -1 Then
varValue = True
Else:
varValue = False
End If
Reports("Report").Section(acDetail).Visible = varValue
End Sub

It seems to work...

Klatuu said:
For 2000, you will need to put the code in the Open event of the report and
have it reference the check box.
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
Reports("Report").Section(acDetail).Visible = forms!MyFormName.chkDetail
End Sub

Ray S. said:
I think the syntax for OpenReport method in 2003 is something like:
DoCmd.OpenReport reportname [, view] [, filtername] [, wherecondition] [,
window-mode] [, openargs]
Now, that is not the syntax for it in 2000, which is:
DoCmd.OpenReport reportnmae [, view] [, filtername] [, wherecondition]

I want to convert coding in 2003 that checks for the status of a checkbox
control (call it chkDetails) and passes it through the OpenReport method to
open a report in preview either showing details or not depending on checkbox
status

I have a button on a form which the user clicks to open the report

The relevant code in 2003 is

DoCmd.OpenReport "Report", acViewPreview, , , , chkDetail

I need an alternative way of handling the check box control in 2000 so if it
is checked (it's default value is set to -1 so it is pre-checked), the report
will open showing a details section ... the Report design code contains

Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
Reports("Report").Section(acDetail).Visible = Me.OpenArgs
End Sub

Can I do this with some If...Then statement in 2000?
 

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

Similar Threads

OpenReport where condition with openargs 1
OpenReport & OpenArgs 2
OpenArgs question 2
OpenArgs problem 8
Access OpenArgs in Access 2010 failing 0
OpenArgs in OpenReport() 1
Paasing an array in OpenArgs 3
OpenArgs Problem 2

Back
Top