A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter thru Form Dialog Box for REPORT



 
 
Thread Tools Display Modes
  #1  
Old December 16th, 2005, 10:07 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Getting Run time error in code : Run Time Error '2467' the expression u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form

  #2  
Old December 16th, 2005, 01:39 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Sandy

If you are using a form to "gather" criteria, and a query that looks to that
form for its criteria, and a report that is based on the query, I don't
understand why you are creating an Access Object.

--
Regards

Jeff Boyce
Office/Access MVP

"Sandy" wrote in message
...
Getting Run time error in code : Run Time Error '2467' the expression u

have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes

have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel

and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form


  #3  
Old December 17th, 2005, 12:09 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Its working now! I have given report name instead of form name in below code

If IsLoaded("Test Appl") = False Then Cancel = True


The file reference was wrong. It should have been "Options Rpt Daily Report"

Thanks

"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form

  #4  
Old January 3rd, 2006, 01:19 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

I have one more report.
This report has similar functionality as below but with following changes:
Report is based on table
Table gets updated by 2 queries : Clear Query and Update Query.
This should get evoked on report open event.
So i have added following codes just below following code as mentioned under :

Report open event

'Open Daily Report 'This was already there below"
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog


'Open Clear Query'" Have added"
DoCmd.OpenQuery "Air Summary Qry Clear", , acEdit

'Open Air Summary Inv Qry' "Have added--This also has parameter linked to
options form
"
DoCmd.OpenQuery "Air Summary Inv Qry", , acEdit

But problem arises, if i cancel report in report parameter form mode by
pressing cancel button, Report cancels but parameter from update query, pops
up and if i cancel those, it asks for debug.

Please advice are problems with codes or need to add something more to
it.

"Sandy" wrote:

Its working now! I have given report name instead of form name in below code

If IsLoaded("Test Appl") = False Then Cancel = True


The file reference was wrong. It should have been "Options Rpt Daily Report"

Thanks

"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form

  #5  
Old January 4th, 2006, 02:27 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Sandy

It sounds like you are saying that your code is doing what you told it to!

If you want to cancel the overall procedure if the report is cancelled,
you'll need to include error handling to know when the report was cancelled,
then bypass (i.e., If ... Else ...) the rest.

--
Regards

Jeff Boyce
Office/Access MVP

"Sandy" wrote in message
...
I have one more report.
This report has similar functionality as below but with following changes:
Report is based on table
Table gets updated by 2 queries : Clear Query and Update Query.
This should get evoked on report open event.
So i have added following codes just below following code as mentioned

under :

Report open event

'Open Daily Report 'This was already there below"
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog


'Open Clear Query'" Have added"
DoCmd.OpenQuery "Air Summary Qry Clear", , acEdit

'Open Air Summary Inv Qry' "Have added--This also has parameter linked to
options form
"
DoCmd.OpenQuery "Air Summary Inv Qry", , acEdit

But problem arises, if i cancel report in report parameter form mode by
pressing cancel button, Report cancels but parameter from update query,

pops
up and if i cancel those, it asks for debug.

Please advice are problems with codes or need to add something more to
it.

"Sandy" wrote:

Its working now! I have given report name instead of form name in below

code

If IsLoaded("Test Appl") = False Then Cancel = True


The file reference was wrong. It should have been "Options Rpt Daily

Report"

Thanks

"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression

u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where

codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close

event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok,

cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned

and
these parameters are linked with above form


  #6  
Old January 4th, 2006, 05:48 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

I would request for more step by step notes on it. I will elaborate further
on it :

Problem arises when i cancel report. IF the report was based on one table or
query, then yours first suggestion works perfectly fine.
But when my report requires 2 queries (append and clear) to run, it creates
problem if i cancel report. If i press cancel button in report, append query
is not disabled and it asks for parameter "Forms![Report Options
Flight]![Opening Date]" and if i cancel them, it gives error. (Ask for
debug). How should i put codes that append query dont ask for inputs, if i
cancel report. When the report is open, parameter form gets linked to append
querty parameter inputs, (as have given command in open report event, to run
append query) but when i close parameter form, append query does'nt get
disabled.. Please advice sir




"Jeff Boyce" wrote:

Sandy

It sounds like you are saying that your code is doing what you told it to!

If you want to cancel the overall procedure if the report is cancelled,
you'll need to include error handling to know when the report was cancelled,
then bypass (i.e., If ... Else ...) the rest.

--
Regards

Jeff Boyce
Office/Access MVP

"Sandy" wrote in message
...
I have one more report.
This report has similar functionality as below but with following changes:
Report is based on table
Table gets updated by 2 queries : Clear Query and Update Query.
This should get evoked on report open event.
So i have added following codes just below following code as mentioned

under :

Report open event

'Open Daily Report 'This was already there below"
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog


'Open Clear Query'" Have added"
DoCmd.OpenQuery "Air Summary Qry Clear", , acEdit

'Open Air Summary Inv Qry' "Have added--This also has parameter linked to
options form
"
DoCmd.OpenQuery "Air Summary Inv Qry", , acEdit

But problem arises, if i cancel report in report parameter form mode by
pressing cancel button, Report cancels but parameter from update query,

pops
up and if i cancel those, it asks for debug.

Please advice are problems with codes or need to add something more to
it.

"Sandy" wrote:

Its working now! I have given report name instead of form name in below

code

If IsLoaded("Test Appl") = False Then Cancel = True

The file reference was wrong. It should have been "Options Rpt Daily

Report"

Thanks

"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression

u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where

codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close

event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok,

cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned

and
these parameters are linked with above form



  #7  
Old January 4th, 2006, 01:18 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Sandy

Please re-read my previous response.

The generic idea is (the following is untested aircode--your syntax may
vary):

your "launch report" code starts here
On Error GoTo ErrorHandler

DoCmd.OpenReport "YourReport",...

your delete & append query code starts here

ExitHe
Exit Sub

ErrorHandler:
If Err.Number = #### Then 'use error number from your "cancelled"
message here
Resume ExitHere
ElseIf Err.Number = 9999 Then 'if you want to test for another error
number,...
'do something else
Else
'do something else if any other error
End If

If you are not familiar with error handling, error codes, or VBA code,
you'll probably need to get some practice with them!

Good luck!

Jeff Boyce
Office/Access MVP




"Sandy" wrote in message
...
I would request for more step by step notes on it. I will elaborate

further
on it :

Problem arises when i cancel report. IF the report was based on one table

or
query, then yours first suggestion works perfectly fine.
But when my report requires 2 queries (append and clear) to run, it

creates
problem if i cancel report. If i press cancel button in report, append

query
is not disabled and it asks for parameter "Forms![Report Options
Flight]![Opening Date]" and if i cancel them, it gives error. (Ask for
debug). How should i put codes that append query dont ask for inputs, if i
cancel report. When the report is open, parameter form gets linked to

append
querty parameter inputs, (as have given command in open report event, to

run
append query) but when i close parameter form, append query does'nt get
disabled.. Please advice sir




"Jeff Boyce" wrote:

Sandy

It sounds like you are saying that your code is doing what you told it

to!

If you want to cancel the overall procedure if the report is cancelled,
you'll need to include error handling to know when the report was

cancelled,
then bypass (i.e., If ... Else ...) the rest.

--
Regards

Jeff Boyce
Office/Access MVP

"Sandy" wrote in message
...
I have one more report.
This report has similar functionality as below but with following

changes:
Report is based on table
Table gets updated by 2 queries : Clear Query and Update Query.
This should get evoked on report open event.
So i have added following codes just below following code as mentioned

under :

Report open event

'Open Daily Report 'This was already there below"
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog


'Open Clear Query'" Have added"
DoCmd.OpenQuery "Air Summary Qry Clear", , acEdit

'Open Air Summary Inv Qry' "Have added--This also has parameter linked

to
options form
"
DoCmd.OpenQuery "Air Summary Inv Qry", , acEdit

But problem arises, if i cancel report in report parameter form mode

by
pressing cancel button, Report cancels but parameter from update

query,
pops
up and if i cancel those, it asks for debug.

Please advice are problems with codes or need to add something more to
it.

"Sandy" wrote:

Its working now! I have given report name instead of form name in

below
code

If IsLoaded("Test Appl") = False Then Cancel = True

The file reference was wrong. It should have been "Options Rpt Daily

Report"

Thanks

"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the

expression
u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then

process
reports. This i have done as per lessons in MS Access Coding where

codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open

event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close

event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok,

cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are

mentioned
and
these parameters are linked with above form




  #8  
Old January 5th, 2006, 05:49 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Thanks its working ok! But 2 things which needs to be cancelled :
If we cancel report form, the parameter pop up comes from queries. Also
blanks reports come with null values. If we enter parameters, then system
keep on poping all parameter information and after that nothing displays..
I wanted to switch of parameter pop up when i cancel report. Secondly,
processed report with null values should not come if i cancel report, It
should'nt do anything..


"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form

  #9  
Old January 5th, 2006, 12:02 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT



"Sandy" wrote:

Thanks its working ok! But 2 things which needs to be cancelled :
If we cancel report form, the parameter pop up comes from queries. Also
blanks reports come with null values. If we enter parameters, then system
keep on poping all parameter information and after that nothing displays..
I wanted to switch of parameter pop up when i cancel report. Secondly,
processed report with null values should not come if i cancel report, It
should'nt do anything..


"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression u have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned and
these parameters are linked with above form

  #10  
Old January 5th, 2006, 01:57 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter thru Form Dialog Box for REPORT

Sandy

Consider posting the code you are now using. It's a bit tough to diagnose
why something isn't working without a look at it...

--
Regards

Jeff Boyce
Office/Access MVP

"Sandy" wrote in message
...
Thanks its working ok! But 2 things which needs to be cancelled :
If we cancel report form, the parameter pop up comes from queries. Also
blanks reports come with null values. If we enter parameters, then system
keep on poping all parameter information and after that nothing

displays..
I wanted to switch of parameter pop up when i cancel report. Secondly,
processed report with null values should not come if i cancel report, It
should'nt do anything..


"Sandy" wrote:

Getting Run time error in code : Run Time Error '2467' the expression u

have
entered refers to an object that is closed or does'nt exist.

Set oAccessObject = CurrentProject.AllForms(strFormName)

when we open report..

(Am working on MDB file)
Am trying to build parameter form which accepts value and then process
reports. This i have done as per lessons in MS Access Coding where codes

have
been writen in form/report and module created.

Following are the codes :

Module Level: Module created by name of Report Parameter
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName 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(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


Under Report "Test Appl" following codes defined in open and close event

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open Even
bInReportOpenEvent = True

'Open Daily Report
DoCmd.OpenForm "Options Rpt Daily Report", , , , , acDialog
'Cancel Report if user clicked the Cancel Button
If IsLoaded("Test Appl") = False Then Cancel = True

'Set the public variable to false to indicate the
' Open event is completed
bInReportOpenEvent = False
End Sub


In Form "Options Rpt Daily Report" following codes defined in ok, cancel

and
open form event

Option Compare Database


Private Sub Command11_Click()
DoCmd.Close
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 Daily Report Only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub Command10_Click()
Me.Visible = False
End Sub

Report is liked to query "Qry Rpt App" where parameters are mentioned

and
these parameters are linked with above form


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ECHO Causing Problems DS General Discussion 5 May 17th, 2005 02:19 AM
strategy for data entry in multiple tables LAF Using Forms 18 April 25th, 2005 04:04 AM
Need to clear controls of Filter form Jan Il Using Forms 2 November 28th, 2004 02:04 PM
Dates in a listbox connected to a form... RusCat Using Forms 13 November 25th, 2004 02:31 AM
Strange stLinkCriteria behaviour on command button Anthony Dowd Using Forms 3 August 21st, 2004 03:01 AM


All times are GMT +1. The time now is 10:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.