Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting an #error when using Trim() in Form Control

Status
Not open for further replies.

jlathem

Technical User
Jul 25, 2010
27


I am rather new to MS Access Forms and need Syntax for an issue I am having in a form.

I need to trim leading and trailing spaces from text coming from a control box called “Comment”. I don’t want someone to be able to just insert blank spaces and call it a comment!

Normally in my web developing I use:
Trim(#Form.Comment#)
[#whatever# is a ColdFusion Variable] in my CFM pages. But I am trying to use Trim in a MS Access 2003 / Table Control.


I found several forum references to using this syntax in the text box’s Control Source:
=Trim([Comment])

But I get an #error message in the Comment text box.

Another reference said to use the code above but change the Control Name to CommentTrim. That got rid of the error message but would not allow me to enter anything in the box.

Does anyone have any suggestions?

Thanks!
 
Access tables will not store trailing spaces in a table. You also won't be able to edit the value in a text box with a control source that is a calcuation ie: =...

Have you tried to see what happens if don't do anything with the trim() function?

Duane
Hook'D on Access
MS Access MVP
 
Hey thank you for your help. I got it worked out.

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top