[AccessD] Question on preferred coding

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Tue Jan 20 22:44:13 CST 2009


Have you considered conditional formatting?  I just discovered it a few
months ago and it really dresses up a form. 


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Gajewski
Sent: Tuesday, January 20, 2009 8:29 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Question on preferred coding

Hi Folks
 
I have a subform with 100+ fields. I want to change the backcolor of each
field based upon the value entered by the user, after validation.
 
Both of the examples below seem to work fine. Is there a preferred way, or
is one better than the other?
 
Thanks
Bob Gajewski
 
Sample #1
  _____  

Private Sub EventSeatA001_BeforeUpdate(Cancel As Integer)
    If Me.ActiveControl <> "A" And Me.ActiveControl <> "R" And
Me.ActiveControl <> "C" And Me.ActiveControl <> "P" And Me.ActiveControl <>
"S" And Me.ActiveControl <> "N" Then
        MsgBox "The valid choices are 'A' (available), 'R' (reserved), 'C'
(chorus/cast), 'P' (pre-sale), 'S' (sold), and 'N' (not available)."
        Cancel = True
        Me.ActiveControl.Undo
    End If
End Sub

  _____  

Private Sub EventSeatA001_AfterUpdate()
SetSeatBackColor
End Sub

  _____  

 
Sample #2
  _____  

Private Sub EventSeatA001_BeforeUpdate(Cancel As Integer)
    If Me.ActiveControl <> "A" And Me.ActiveControl <> "R" And
Me.ActiveControl <> "C" And Me.ActiveControl <> "P" And Me.ActiveControl <>
"S" And Me.ActiveControl <> "N" Then
        MsgBox "The valid choices are 'A' (available), 'R' (reserved), 'C'
(chorus/cast), 'P' (pre-sale), 'S' (sold), and 'N' (not available)."
        Cancel = True
        Me.ActiveControl.Undo
    Else
        SetSeatBackColor
    End If
End Sub

  _____  

  _____  

 
P Please consider the environment before printing this e-mail 
 
--
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