[AccessD] Is there a simpler way?

Rocky Smolin rockysmolin2 at gmail.com
Tue Jul 12 19:35:56 CDT 2022


Yes.  Ugly.  But in compensation it is perfectly understandable, readable,
maintainable. By any programmer. And five years from now you won't be
trying to figure out what this code does as opposed to 'clever' code.
Clarity is it's own reward.

r

On Tue, Jul 12, 2022 at 3:46 PM John Colby <jwcolby at gmail.com> wrote:

> I need a text enum (colors to be specific).  Enums are longs.  Sigh
>
> Public Enum enumVBColors
>     Black = vbBlack
>     Red = vbRed
>     Green = vbGreen
>     Yellow = vbYellow
>     Blue = vbBlue
>     Magenta = vbMagenta
>     Cyan = vbCyan
>     White = vbWhite
> End Enum
>
> Function fColor(intColor As enumVBColors) As String
>     Select Case intColor
>     Case enumVBColors.Black
>         fColor = "Black"
>     Case enumVBColors.Blue
>         fColor = "Blue"
>     Case enumVBColors.Cyan
>         fColor = "Cyan"
>     Case enumVBColors.Green
>         fColor = "Green"
>     Case enumVBColors.Magenta
>         fColor = "Magenta"
>     Case enumVBColors.Red
>         fColor = "Red"
>     Case enumVBColors.White
>         fColor = "White"
>     Case enumVBColors.Yellow
>         fColor = "Yellow"
>     End Select
> End Function
>
> Does the trick but DAMN!  I can use these text strings as colors in the
> HTML tags.  But DAMN!  I hate ugly and this is just ugly.
>
> Let the slappin' commence.
>
> --
> John W. Colby
> Colby Consulting
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list