Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Makeing a Criteria form for a report.


Message #1 by "DON LOWE" <donlowe@s...> on Sun, 14 Oct 2001 08:26:30 +0200

I am following Example code to show a criteria form for a report. The 

example works, my attempt does not so please could someone point me in 

the right direction.



The error message is: Sub or Function Not Defined.  and the IsLoaded is 

highlighted.

When I check the "List Properties/Methods", IsLoaded is not included.



This is the code:



Private Sub Report_Open(Cancel As Integer)

'Ignore an error if it occurs

On Error Resume Next



'Open the report criteria form

DoCmd.OpenForm "frmReportCriteria", _

    WindowMode:=3DacDialog

    OpenArgs:=3D"rptCourseStudents"



'If the criteria form is not loaded, display an error

'message and cancel the printing of the report

'(the form will not be loaded if the user clicks cancel)

If Not IsLoaded("frmReportCriteria") Then

    MsgBox "Criteria Form Not Successfully Loaded, Cancelling Report"

    Cancel =3D True

End If

End Sub





Message #2 by Brian Skelton <brian.skelton@b...> on Sun, 14 Oct 2001 12:25:55 +0100
I think this is the function you're looking for (from Microsofts Solutions database)



 Function IsLoaded(strFrmName As String) As Boolean

    

    '  Determines if a form is loaded.

    

    Const conFormDesign = 0

    Dim intX As Integer

    

    IsLoaded = False

    For intX = 0 To Forms.Count - 1

        If Forms(intX).FormName = strFrmName Then

            If Forms(intX).CurrentView <> conFormDesign Then

                IsLoaded = True

                Exit Function  ' Quit function once form has been found.

            End If

        End If

    Next



End Function



-BDS



-----Original Message-----

From:	DON LOWE [SMTP:donlowe@s...]

Sent:	14 October 2001 07:27

To:	Access

Subject:	[access] Makeing a Criteria form for a report.





I am following Example code to show a criteria form for a report. The 

example works, my attempt does not so please could someone point me in 

the right direction.



The error message is: Sub or Function Not Defined.  and the IsLoaded is 

highlighted.

When I check the "List Properties/Methods", IsLoaded is not included.



This is the code:



Private Sub Report_Open(Cancel As Integer)

'Ignore an error if it occurs

On Error Resume Next



'Open the report criteria form

DoCmd.OpenForm "frmReportCriteria", _

    WindowMode:=3DacDialog

    OpenArgs:=3D"rptCourseStudents"



'If the criteria form is not loaded, display an error

'message and cancel the printing of the report

'(the form will not be loaded if the user clicks cancel)

If Not IsLoaded("frmReportCriteria") Then

    MsgBox "Criteria Form Not Successfully Loaded, Cancelling Report"

    Cancel =3D True

End If

End Sub





Message #3 by "DON LOWE" <donlowe@s...> on Sun, 14 Oct 2001 19:07:47 +0200
Brian

Thank you for the help. The next stage in this challenge is:

My report criteria Form comes up allright and seems to work, but the 

default Access Parameter form still comes up and I need to know how to 

stop the default form being created etc so that only my custom form 

comes up.



Regards

Don





Message #4 by Brian Skelton <brian.skelton@b...> on Sun, 14 Oct 2001 21:38:39 +0100
Don



You're either missing the code that sets the parameters from the 

information entered in your criteria Form, or your reports SQL query is 

not referencing the correct control on your criteria form.



Have another look at your example database to see how it passes the 

information fron criteria form to the report.



Brian



-----Original Message-----

From:	DON LOWE [SMTP:donlowe@s...]

Sent:	14 October 2001 18:08

To:	Access

Subject:	[access] RE: Makeing a Criteria form for a report.



Brian

Thank you for the help. The next stage in this challenge is:

My report criteria Form comes up allright and seems to work, but the 

default Access Parameter form still comes up and I need to know how to 

stop the default form being created etc so that only my custom form 

comes up.



Regards

Don








  Return to Index