G
Guest
i am trying to use parameters from a form to open a report. i have used the
information found at
http://office.microsoft.com/en-us/assistance/HA011170771033.aspx to do this.
however, i was getting an error, it pops up a printing dialog box for a
second then pops up a modal box saying something like "this cannot be carried
out while processing a form or report open event." i changed a couple of
lines of code in the command button on the forms click event procedure. new
code is
Private Sub cmdDateSumQuery_Click()
On Error GoTo Err_cmdDateSumQuery_Click
Dim stDocName As String
stDocName = "rptDateRangeSums"
DoCmd.OpenReport stDocName, acViewPreview
Exit_cmdDateSumQuery_Click:
Exit Sub
Err_cmdDateSumQuery_Click:
MsgBox Err.Description
Resume Exit_cmdDateSumQuery_Click
End Sub
below is the code for my report
Option Compare Database
Private Sub Report_Close()
DoCmd.Close acForm, "frmDateRangeSums"
End Sub
Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True
' Open frmDateRangeSums Dialog
DoCmd.OpenForm "frmDateRangeSums", , , , , acDialog
' Cancel Report if User Clicked the Cancel Button
If IsLoaded("frmDateRangeSums") = False Then Cancel = True
' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub
and below is my code for the module
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?
Function IsLoaded(ByVal frmDateRangeSums As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(frmDateRangeSums)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
the acCurViewDesign line is coming up an error saying that the
acCurViewDesign is a "Variable not defined" but the line
"Function IsLoaded(ByVal frmDateRangeSums As String) As Boolean" is
highlighted in yellow.
any help here would be awesome and greatly appreciated. thanks
([email protected])
information found at
http://office.microsoft.com/en-us/assistance/HA011170771033.aspx to do this.
however, i was getting an error, it pops up a printing dialog box for a
second then pops up a modal box saying something like "this cannot be carried
out while processing a form or report open event." i changed a couple of
lines of code in the command button on the forms click event procedure. new
code is
Private Sub cmdDateSumQuery_Click()
On Error GoTo Err_cmdDateSumQuery_Click
Dim stDocName As String
stDocName = "rptDateRangeSums"
DoCmd.OpenReport stDocName, acViewPreview
Exit_cmdDateSumQuery_Click:
Exit Sub
Err_cmdDateSumQuery_Click:
MsgBox Err.Description
Resume Exit_cmdDateSumQuery_Click
End Sub
below is the code for my report
Option Compare Database
Private Sub Report_Close()
DoCmd.Close acForm, "frmDateRangeSums"
End Sub
Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True
' Open frmDateRangeSums Dialog
DoCmd.OpenForm "frmDateRangeSums", , , , , acDialog
' Cancel Report if User Clicked the Cancel Button
If IsLoaded("frmDateRangeSums") = False Then Cancel = True
' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub
and below is my code for the module
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?
Function IsLoaded(ByVal frmDateRangeSums As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(frmDateRangeSums)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
the acCurViewDesign line is coming up an error saying that the
acCurViewDesign is a "Variable not defined" but the line
"Function IsLoaded(ByVal frmDateRangeSums As String) As Boolean" is
highlighted in yellow.
any help here would be awesome and greatly appreciated. thanks
([email protected])