Ltrim

P

Peter

Hi all, i have a issue regarding dataentry in a field.

Private Sub Apples_AfterUpdate()
Me.[Apples] = LTrim(Me.[Apples])
End Sub

I am often pasting in data in this fieled and it happens that i also paste
in one or two "empty" position after...

I want the field to accept only alphanumeric data (dynamic lenght) and no
"empty spaces...

Suggestions?

Thanks!
 
J

John W. Vinson

Hi all, i have a issue regarding dataentry in a field.

Private Sub Apples_AfterUpdate()
Me.[Apples] = LTrim(Me.[Apples])
End Sub

I am often pasting in data in this fieled and it happens that i also paste
in one or two "empty" position after...

I want the field to accept only alphanumeric data (dynamic lenght) and no
"empty spaces...

Suggestions?

Thanks!

Access won't store trailing blanks in any case, and this code will remove
leading blanks - so it SHOULD be working. Isn't it? What are you getting?

If (for some strange reason) it is storing trailing blanks, you can get rid of
them by just using Trim() instead of LTrim. LTrim removes "left" blanks; Trim
removes both left and right blanks.
 
P

Peter

Thanks JOhn,,why do i never see the simplicity :) It works well!

John W. Vinson said:
Hi all, i have a issue regarding dataentry in a field.

Private Sub Apples_AfterUpdate()
Me.[Apples] = LTrim(Me.[Apples])
End Sub

I am often pasting in data in this fieled and it happens that i also paste
in one or two "empty" position after...

I want the field to accept only alphanumeric data (dynamic lenght) and no
"empty spaces...

Suggestions?

Thanks!

Access won't store trailing blanks in any case, and this code will remove
leading blanks - so it SHOULD be working. Isn't it? What are you getting?

If (for some strange reason) it is storing trailing blanks, you can get rid of
them by just using Trim() instead of LTrim. LTrim removes "left" blanks; Trim
removes both left and right blanks.
 

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

Similar Threads


Top