Type mismatch error

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 ?
 
K

Ken Snell [MVP]

Change
Me![txtComments].SelStart = Len(Me![txtComments])

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top