Sorting and grouping

suepowell

Registered User.
Local time
Today, 13:52
Joined
Mar 25, 2003
Messages
282
Hi

I have a report which I want to use to produce a list of parts with a date expired, both sorted by part number or date.

I achieve this using a form to select the sort order, and then call the report from this form and set up the sort order in sorting and grouping using the value on the still open report.

This works OK.

I also want to call up the same report from a different form to show expired dates for the part number being viewed in that form.

I get the correct records by using a where condition in the report opening statement. Again this works OK.

My problem is that when I call the report from the parts form, the selector form is not open, so I get an error pop up box asking me for the value from the selector form.

How do I test for the form being open in the iif statement I am using in the sorting and grouping box, or can I set up the sorting and grouping in VBA code, or is there a better way?


HELP!!!!


Sue
 
Hi Rich

Thanks for the answer, but it still doesn't work.

I tried putting the isloaded function in the expression I am using in the sorting and grouping dialog box, but the function is not recoginsed here. I didn't think it would be but was happy to try.

I tried to set up the value of a parameter I could test in the sorting and grouping, by putting some code in the on open event of the report. although the value of the variable is set ok in the on open event, it is not available in the sorting and grouping. I presume it a to do with when things are set up etc.

Can you help any more

Sue
 
Try Putting this in a module first then try it.

Code:
Public Function IsLoaded(strFormName As String) As Boolean
sFormOpen = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) = acObjStateOpen)
End Function
 
Thanks for this suggestion

I have tried this, both in an independant module, and in the module behind the report. It still doesn't work.

I have solved the problem by opening the selection form hidden in the background before I open the report.

This does work and the client does not see anything, but it seems a clumsy way of doing things.

Thanks for the help everyone.

Sue.
 
Glad you managed to get it to work, just to clarify for future reference though for anyone else reading this.

You need put this in a module

Code:
Public Function IsLoaded(strFormName As String) As Boolean
sFormOpen = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) = acObjStateOpen)
End Function

And then use the code as Rich posted in an event on your report or form.

Code:
If IsLoaded(YouForm) Then
DoWhatever
Else
Exit Sub
 

Users who are viewing this thread

Back
Top Bottom