Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Passing Variable value to a report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alain - 05 Dec 2005 19:21 GMT
Hi to all,

I have build a report that is dynamic build by the user. My problem is the
Order By criteria of the report.
On my form command button to open the report I have a strSort variable that
is used to build my Order By string.
On the command button I use the following to open the report:

  DoCmd.OpenReport stDocName, acPreview, , strCond
  If Err.Number = 2501 Then Err.Clear

     'application du sorting au rapport
     With Reports![rpt-GlobalCieList]
        .OrderBy = strSort
        .OrderByOn = True
     End With
       Reports![rpt-GlobalCieList]![Label2].Caption = "( Sorted by: " &
strShow & " )"

On that report, I have the NoData event being fired when there is no data to
display since there was new fields added for the criteria selection. I close
the report at the NoData event (cancel = true) so the user is being send
back to the form to make modification to the report. Now when I do that I
get error "2501 The open report action was Cancelled" at he
DoCmd.OpenReport.

After some testing I was able to find a solution for this, I close the
report window at the Report_Activate or at the Report_Page which is working
just fine but I run into another error "2451 Report is not open or does not
exist......"

Can passing my variable string to the Report_Open or Report_Activate ( where
I apply the OrderBy) solve my problem ??? or is there anything else I can do
to correct this.

Is there a way to find if a report is open, I have tried the IsLoaded
function but it works only on forms:

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
   Const conObjStateClosed = 0
   Const conDesignView = 0
   If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
       If Forms(strFormName).CurrentView <> conDesignView Then
           IsLoaded = True
       End If
   End If
End Function

Thanks

Alain
Marshall Barton - 05 Dec 2005 19:39 GMT
[snip duplicate question]

Answered in your earlier thread

Signature

Marsh
MVP [MS Access]

Alain - 06 Dec 2005 13:59 GMT
I tought I posted this only once

> [snip duplicate question]
>
> Answered in your earlier thread
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.