Re: Case Change By Itself in VBA Code - Help

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I'm not sure this was the case. I, too, have observed the behavior where Enum's members' case do not get preserved correctly whereas built-in Enum members can preserve the case.

To illustrate further the problem using Jack's example:

Public Enum eRecordStatus
dsrsActive = 0
dsrsArchived = 1
dsrsPending = 2
End Enum


.... <in some random procedure>

Debug.Print eRecordStatus.dsrsPending

If we type out the enum name and use the intellisense to select the member of the enum, we get the correct case. However if we were to ignore the intellisense and type the whole thing:

Debug.Print eRecordStatus.dsrspending

What would happen is in the declaration for the Enum, the dsrsPending member inherits the new case as I just typed.

Note that eRecordStatus.dsrsPending and dsrsPending both are basically equivalent and will return the same value (2) without having to dim the member in a procedure (and without testing, I would think it would not be correct to re-dim a member in each procedure, just like we don't have to re-dim built-in enum members such as dbOpenDynaset or dbOpenSnapshot, both which preserve their case correctly.)

To my mind, this is absolutely a bug. I would be glad to concede that in case of variable i changing to I or vice versa because it was not properly dimmed, then that's the developer's fault. However, as I've stated, I've worked on some projects where even built-in library seem to lose their case (e.g. DAO.Recordset => dao.Recordset).

There is no apparent ill effects; all it does is annoy the heck out of me as I usually use casing to signal that I've entered my variables correctly.

Klatuu wrote:
dsrsPending is not dimmed.
.



Relevant Pages

  • [PATCH 05/15] drbd: user space interface (based upon connector/netlink)
    ... new file mode 100644 ... This file is part of DRBD by Philipp Reisner and Lars Ellenberg. ... +enum drbd_disconnect_p { ... +#define NL_INTEGER(pn, pr, member) ...
    (Linux-Kernel)
  • [PATCH 06/16] drbd: user space interface (based upon connector/netlink)
    ... new file mode 100644 ... This file is part of DRBD by Philipp Reisner and Lars Ellenberg. ... +enum drbd_disconnect_p { ... +#define NL_INTEGER(pn, pr, member) ...
    (Linux-Kernel)
  • Re: Ruby idiom for enum?
    ... aggregate all the data into the enum member itself. ... class Enum < Module ... def initialize ...
    (comp.lang.ruby)
  • Re: [Enum]
    ... Where can I find an explaination of the usage of in an Enum? ... what the brackets do is make that member of the Enum type hidden. ... Public Property Let SortType(ColumnIndex As Long, ... it's customary to use an underscore as the first character for the hidden enum member. ...
    (microsoft.public.vb.general.discussion)