[AccessD] Reports Question

John Ruff papparuff at attbi.com
Tue Apr 15 14:19:51 CDT 2003


Sorry about that, so here's another way that works for Access97 and
Access2K.

If you don't have a function that tells you that a form is open, then copy
this to a module (I place it in my basUtilities) module

Public Function IsLoaded(strFormName As String) As Boolean
 ' Returns True if the specified form is open in Form view or Datasheet
view.
  ' Comments  : Determines if the named form is open
  ' Parameters: strFormName - form to check for
  ' Returns   : True - form is open, False - form is not open
  '
  IsLoaded = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0)
    
End Function

Then,

In the Format Event of the report's detail section;

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If IsLoaded("frm_MyForm") = True Then
    	  If forms!frm_MyForm!MyCheckBox=True then
        	' Make the backcolor of the
        	' Detail Section the color
        	' green
       	Detail.BackColor = vbGreen
	  End If		
    End If
    
End Sub

John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

www.noclassroom.com
Live software training
Right over the Internet

Home: 253.588.2139
Cell: 253.307/2947
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
	and your plans will succeed." Proverbs 16:3



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Tuesday, April 15, 2003 11:34 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Reports Question


Sorry, John, but reports didn't get an OpenArgs property until 2002.

Charlotte Foust

-----Original Message-----
From: John Ruff [mailto:papparuff at attbi.com] 
Sent: Tuesday, April 15, 2003 5:40 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Reports Question


You can use the report's OpenArg to determine if the checkbox is checked on
the form, then use the Format Event in the report's Detail section to
determine if the form's checkbox has been checked, and if it has, change the
backcolor of the detail section.

So,

Code to set the OpenArgs on the form that opens the report.
	
DoCmd.OpenReport"MyReport", OpenArgs:=MyCheckBox

In the Format Event of the report's detail section;

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.OpenArgs = True Then
        ' Make the backcolor of the
        ' Detail Section the color
        ' green
       Detail.BackColor = vbGreen
    End If
    
End Sub


John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

"Commit to the Lord whatever you do,
	and your plans will succeed." Proverbs 16:3

<snip>
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list