Remove Spaces using AfterUpdate? 
Author Message
 Remove Spaces using AfterUpdate?

I hope someone can help...

I want to try to delete blank spaces from a record in Access 2000.  I
wanted to try to do it during the data-entry.  So I want to use the
AfterUpdate function to delete the blanks.  For example:

in Form1 someone types "abc def" into Contro1.
I would like to use AfterUpdate to change it to "abcdef"
Private Sub Control1_AfterUpdate()
  new.value = Old.value without " "
End Sub

I don't know if this is possible.  I'm rather new at this.  Any help
would be greatly appreciated.



Tue, 20 Sep 2005 06:12:07 GMT  
 Remove Spaces using AfterUpdate?
Using Access 2000
Code the After Update event:

[Control1] = Replace([Control1]," ","")

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Quote:
> I hope someone can help...

> I want to try to delete blank spaces from a record in Access 2000.  I
> wanted to try to do it during the data-entry.  So I want to use the
> AfterUpdate function to delete the blanks.  For example:

> in Form1 someone types "abc def" into Contro1.
> I would like to use AfterUpdate to change it to "abcdef"
> Private Sub Control1_AfterUpdate()
>   new.value = Old.value without " "
> End Sub

> I don't know if this is possible.  I'm rather new at this.  Any help
> would be greatly appreciated.



Tue, 20 Sep 2005 07:38:20 GMT  
 Remove Spaces using AfterUpdate?


Quote:
> Using Access 2000
> Code the After Update event:

> [Control1] = Replace([Control1]," ","")

> --
> Fred

> Please reply only to this newsgroup.
> I do not reply to personal e-mail.



> > I hope someone can help...

> > I want to try to delete blank spaces from a record in Access 2000.  I
> > wanted to try to do it during the data-entry.  So I want to use the
> > AfterUpdate function to delete the blanks.  For example:

> > in Form1 someone types "abc def" into Contro1.
> > I would like to use AfterUpdate to change it to "abcdef"
> > Private Sub Control1_AfterUpdate()
> >   new.value = Old.value without " "
> > End Sub

> > I don't know if this is possible.  I'm rather new at this.  Any help
> > would be greatly appreciated.

Fredg, I would have thought the After Update event to be too late, as
the data is by then saved.  Wouldn't the Before Update event be more
appropriate in this case, perhaps?

Hugh



Tue, 20 Sep 2005 08:06:57 GMT  
 Remove Spaces using AfterUpdate?
Hi Hugh

Quote:
> Fredg, I would have thought the After Update event to be too late, as
> the data is by then saved.  Wouldn't the Before Update event be more
> appropriate in this case, perhaps?

Unfortunately you can't change the data in a bound control in BeforeUpdate.
Seems crazy, but that's the way it is.

AfterUpdate for the control happens before the record is saved anyway.

--
Cheers!
Graham Mandeno [Access MVP]
Auckland, New Zealand

Return mail address is invalid in a vain attempt to reduce spam.

Please post new questions or followups to newsgroup.



Tue, 20 Sep 2005 08:24:41 GMT  
 Remove Spaces using AfterUpdate?
hi
use this:
Private Sub Text1_AfterUpdate()
Text2 = Replace(Text1, " ", "")
End Sub

this will replace all spaces in text1 with zero lengths,
giving you the result you wanted. (i hope)
Erez.

Quote:
>-----Original Message-----
>I hope someone can help...

>I want to try to delete blank spaces from a record in
Access 2000.  I
>wanted to try to do it during the data-entry.  So I want
to use the
>AfterUpdate function to delete the blanks.  For example:

>in Form1 someone types "abc def" into Contro1.
>I would like to use AfterUpdate to change it to "abcdef"
>Private Sub Control1_AfterUpdate()
>  new.value = Old.value without " "
>End Sub

>I don't know if this is possible.  I'm rather new at
this.  Any help
>would be greatly appreciated.
>.



Tue, 20 Sep 2005 14:23:23 GMT  
 Remove Spaces using AfterUpdate?
Thanks for everyone's help.  I would not have found the solution
without your help.  This is the code that made it work:

Private Sub Control1_AfterUpdate()
  Dim text1 As String
  text1 = Me!Contro1
  Me!Control1 = Replace([text1], " ", "")
End Sub

Quote:

> hi
> use this:
> Private Sub Text1_AfterUpdate()
> Text2 = Replace(Text1, " ", "")
> End Sub

> this will replace all spaces in text1 with zero lengths,
> giving you the result you wanted. (i hope)
> Erez.

> >-----Original Message-----
> >I hope someone can help...

> >I want to try to delete blank spaces from a record in
>  Access 2000.  I
> >wanted to try to do it during the data-entry.  So I want
>  to use the
> >AfterUpdate function to delete the blanks.  For example:

> >in Form1 someone types "abc def" into Contro1.
> >I would like to use AfterUpdate to change it to "abcdef"
> >Private Sub Control1_AfterUpdate()
> >  new.value = Old.value without " "
> >End Sub

> >I don't know if this is possible.  I'm rather new at
>  this.  Any help
> >would be greatly appreciated.
> >.



Tue, 20 Sep 2005 22:55:30 GMT  
 Remove Spaces using AfterUpdate?


Quote:
> Hi Hugh

> > Fredg, I would have thought the After Update event to be too late, as
> > the data is by then saved.  Wouldn't the Before Update event be more
> > appropriate in this case, perhaps?

> Unfortunately you can't change the data in a bound control in BeforeUpdate.
> Seems crazy, but that's the way it is.

> AfterUpdate for the control happens before the record is saved anyway.

> --
> Cheers!
> Graham Mandeno [Access MVP]
> Auckland, New Zealand

> Return mail address is invalid in a vain attempt to reduce spam.

> Please post new questions or followups to newsgroup.

Yes you're quite right, of course.  In mitigation it was 1 a.m. and I
was knackered!

Hugh



Wed, 21 Sep 2005 06:48:24 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Quick way to remove spaces from a used range

2. Need to remove 1 space in field ie move data 1 space to left

3. difference between free space and space used

4. Using .setfocus with afterupdate

5. Combo Boxes and Using AfterUpdate

6. Should I be using beforeupdate or afterupdate ?

7. Fetching a value from table using AfterUpdate

8. Forms AfterUpdate Event using date

9. Removing attachments using "Remove"

10. Word 2000 Removing Components (using add/remove programs control panel) if missing CD


 
Powered by phpBB® Forum Software © phpBB Group