If the error states that the object named number_5 does not have this
method, chances are that it is not a text box.
Perhaps the field in the form's RecordSource is named number_5, but the text
box bound to this field is named something else, such as Text8.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"alex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Jun 1, 12:57 pm, "BruceM" <bam...@yawhodotcalm.not> wrote:
>> "alex" <sql_...@yahoo.com> wrote in message
>>
>> news:(E-Mail Removed)...
>>
>>
>>
>>
>>
>> > On Jun 1, 10:51 am, "Allen Browne" <AllenBro...@SeeSig.Invalid> wrote:
>> >> Enclose the name in square brackets.
>>
>> >> For example,if the text box is named 5, use:
>> >> Me.[5].Locked = False
>>
>> >> --
>> >> Allen Browne - Microsoft MVP. Perth, Western Australia
>> >> Tips for Access users -http://allenbrowne.com/tips.html
>> >> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> >> "alex" <sql_...@yahoo.com> wrote in message
>>
>> >>news:(E-Mail Removed)...
>>
>> >> > I'm trying to write some code that locks several controls on a
>> >> > form...
>> >> > Some of the names of the controls are numbers or have numbers in the
>> >> > name.
>> >> > I'm getting an error in VBA at run time, related to these numbers.
>> >> > Do I have to change the names of the controls, or is there a work-
>> >> > around?
>>
>> >> > thanks,
>> >> > alex- Hide quoted text -
>>
>> >> - Show quoted text -
>>
>> > Thanks Allen.
>>
>> > I also have a bound control named, e.g., Number_5.
>> > Is there a special case for this? I tried putting the whole name and/
>> > or the number in brackets...to no avail
>>
>> > alex
>>
>> Rather than describing what you have done, it would be best to post the
>> actual code, including the event in which it occurs. Also, describe the
>> expected result, and what happens instead.- Hide quoted text -
>>
>> - Show quoted text -
>
> Ok Bruce,
>
> Here's the code: 'Me!NUMBER_5.Locked = False
> I expect it to unlock the control named number_5
> Instead I get a run time error: Object doesn't support this method or
> property
>
> I have other controls that are named with just numbers and Allen's
> advise works fine.
> I'm having problems however with alpha/numeric controls like
> 'Number_5'; the brackets don't work.
>
> alex