Form handling error

  • Thread starter One complete fool
  • Start date
O

One complete fool

I am getting the error message "The field is too small to accept the
amount of data...."

I know what is causing the error, but I can't seem to find a way
around it.

The code is:

Private Sub products_description_AfterUpdate()

Me.[products_head_desc_tag] = Me.[products_description]
On Error Resume Next

End Sub

products_description is memo
products_head_desc_tag is text (Len-120) - which filling is causing
the error.

products_head_desc_tag is to auto fill the description meta tag on a
dyanamically created html page. For this, I am trying to grab only
the first 120 characters of the products_description field.

Is there a way to do this without getting the error message? I
haven't been able to figure one out.

Thank you
 
O

One complete fool

Try...
[products_head_desc_tag] = Left([products_description],120)

Thank you that was exatly what I needed. I knew I had to truncate
that string, but...

Believe it or not, I searched the web, plus searched through 6 VB
books I have here and not a one had a sufficient enough description to
truncate under these circumstances.

Again thank you,
 
O

One complete fool

Try...
[products_head_desc_tag] = Left([products_description],120)

Just a quick check back to make sure that I am interpreting this
correctly.

Do I not need the "Me." on this code?

Thank you.
 
D

Douglas J. Steele

Try...
[products_head_desc_tag] = Left([products_description],120)

Just a quick check back to make sure that I am interpreting this
correctly.

Do I not need the "Me." on this code?

If [products_head_desc_tag] and [products_description] are the names of
controls on the form, or fields in the form's recordset, then yes, you
should use Me. to ensure Access realizes it.

(And if [products_head_desc_tag] and [products_description] are the names of
both controls on the form and fields in the form's recordset, I'd recommend
renaming the controls so that Access can tell the difference!)
 
Top