Read-Only Text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been using the following code to convert all text to upper case. It
works in all my text boxes except one.

Private Sub Name_AfterUpdate()
Name = StrConv(Name, vbUpperCase)
End Sub

In the text box Name if I enter a value Get an error message saying that the
text box is read only and cannot do the conversion.

Where can I change the read-only property?
 
Darren,

I suspect your problem is the name of the textbox! Are you getting error
2135 (This property is read-only and can't be set)?

Name is a reserved keyword in Jet; as a matter of fact, each and every
object in Access has a Name property, including the form whose name you
are trying to change in your code - this is what Access is not letting
you do!

One solution is to make an explicit reference to the textbox, like:

Me.Controls("Name") = StrConv(Me.Controls("Name"), vbUpperCase)

but this is only a half measure. The best thing to do is to use a
different textbox name.

Here's a list of reserved keywords in Jet:

http://support.microsoft.com/default.aspx?scid=kb;en-us;321266

HTH,
Nikos
 
Back
Top