Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2008

Tip: Looking for answers? Try searching our database.

formatting using VB If statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 13 Mar 2008 17:57 GMT
I have the following code on the On Format property of one of my Headers on
my report:

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
   If ChangePri = True Then
       Priority.BackColor = vbGreen
       Priority.FontWeight = 800
       
   Else
       
       Priority.BackColor = vbWhite
       Priority.FontWeight = 400
       
       
    If min = True Then
       sono.BackColor = vbYellow
       sono.FontWeight = 800
 
     
   Else
       sono.BackColor = vbWhite
       sono.FontWeight = 400
       
  If missed = True Then
       QtyShip.BackColor = vbRed
       QtyShip.FontWeight = 800
 
     
   Else
       QtyShip.BackColor = vbWhite
       QtyShip.FontWeight = 400
   
End If
End If
End If

End Sub

The colors are not changing.  Is there any other properties that need to be
changed on the report to make this code usable?
fredg - 13 Mar 2008 19:06 GMT
> I have the following code on the On Format property of one of my Headers on
> my report:
[quoted text clipped - 36 lines]
> The colors are not changing.  Is there any other properties that need to be
> changed on the report to make this code usable?

Your END If's seem to be in the wrong place... they're all at the end.
Problem is, from your code, I have no idea what belongs where?
Here is an example of the correct syntax.

If CriteriaA = True Then
    Do your true stuff here
Elseif CriteriaB = True Then
    Do CriteriaB stuff here
        If Some other criteria within CriteriaB= True Then
            Do more stuff here
        End If
Else
    Do the Stuff here that does not fit in above
        If some more criteria = true Then
            More stuff to do
        End If
End If

Try again.
   

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

John - 13 Mar 2008 19:47 GMT
Fred,

Thanks to the reply.  Changing my code to your format worked. Thanks!

> > I have the following code on the On Format property of one of my Headers on
> > my report:
[quoted text clipped - 57 lines]
> Try again.
>    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.