Type mismatch error

  • Thread starter Thread starter la
  • Start date Start date
L

la

I was trying to prevent someone from accidentally deleting
data in a memo field and added the following on the
GotFocus event: Me![txtComments].SelStart = Len(Me!
[txtComments]). The problem is that if there is no data
and I tab into the textbox, I get a Run-time error '13',
Type Mismatch.error. How can I fix this ?
 
Change
Me![txtComments].SelStart = Len(Me![txtComments])

to this:
If Len(Me![txtComments]) > 0 Then Me![txtComments].SelStart =
Len(Me![txtComments])
 
Back
Top