Generally, I do not monkey with renaming controls on forms
whose name, by default, matches the name of their related
table fields. But I noticed the following today
If IsNull(Me!VColor) Then
DoCmd.CancelEvent
SaveButtonClicked = False
MyString = "You must tell us the color of the vehicle."
MyString = MyString & "Please choose the vehicle color from "
MyString = MyString & "the drop-down box provided on form."
MsgBox MyString, vbExclamation, "Vehicle Color Required - "
Exit Sub
End If
This code has been in my app for 9-mos. "What's the point", you ask?
The point is this: The control's name is NOT VColor. Its a combo-box
control and its name is ColorChooserBox. The related table field name
is [VColor].
A line in there like this
Me!VColor.BackColor = 255
would-a-produced an error. I would-a-seen & fixed it.
But because Null is a perfectly acceptable value for the table field
value - I got no error. I would have appreciated one, however. The
result of this SNAFU is not monumental really. Because either of the
following in the immediate window yield the same result:
?forms!frmVehicleEntryForm!VColor
Azure
?forms!frmVehicleEntryForm!ColorChooserBox
Azure
But how do I knoiw that I won't be so lucky in another situation
that's similar - but slightly different. Is it possible, in A97, for
Access to use a different naming convention for controls on forms?
I would-a-been happier, I think, if Microsoft had defaulted names to
something like ctlVColor or comboxVColor or cboxVColor. I think I
would-a-been happier with cbox1, cbox2, cbox3... like they do with
command buttons.