dbTalk Databases Forums  

Remove a comma programmatically

comp.databases.ms-access comp.databases.ms-access


Discuss Remove a comma programmatically in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
musicloverlch
 
Posts: n/a

Default Remove a comma programmatically - 04-24-2009 , 02:15 PM






I have 2 fields of names that can't have commas. Is there a way I can
programmatically "find and replace"?

Thanks,
Laura

Reply With Quote
  #2  
Old   
musicloverlch
 
Posts: n/a

Default Re: Remove a comma programmatically - 04-24-2009 , 03:20 PM






I have to take a text file with about 600 records in it, import it,
total it up, store the totals, and export it in a specific delimited
format for another company. The file coming in might have commas in
the name that I need to remove. Is there a way I can do it in VB?
Can I use the code below and cycle through the records?


On Apr 24, 2:44*pm, fredg <fgutk... (AT) example (DOT) invalid> wrote:
Quote:
On Fri, 24 Apr 2009 12:15:45 -0700 (PDT), musicloverlch wrote:
I have 2 fields of names that can't have commas. Is there a way I can
programmatically "find and replace"?

Thanks,
Laura

Replace with what?
When? During entry?
Code the form control's AfterUdate event:
Me![ControlName] = Replace([ControlName],",","")

The above will just remove commas.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


Reply With Quote
  #3  
Old   
musicloverlch
 
Posts: n/a

Default Re: Remove a comma programmatically - 04-24-2009 , 03:44 PM



Perfect! You have saved my life. Thanks!

On Apr 24, 3:30*pm, fredg <fgutk... (AT) example (DOT) invalid> wrote:
Quote:
On Fri, 24 Apr 2009 13:20:54 -0700 (PDT), musicloverlch wrote:
I have to take a text file with about 600 records in it, import it,
total it up, store the totals, and export it in a specific delimited
format for another company. The file coming in might have commas in
the name that I need to remove. *Is there a way I can do it in VB?
Can I use the code below and cycle through the records?

On Apr 24, 2:44*pm, fredg <fgutk... (AT) example (DOT) invalid> wrote:
On Fri, 24 Apr 2009 12:15:45 -0700 (PDT), musicloverlch wrote:
I have 2 fields of names that can't have commas. Is there a way I can
programmatically "find and replace"?

Thanks,
Laura

Replace with what?
When? During entry?
Code the form control's AfterUdate event:
Me![ControlName] = Replace([ControlName],",","")

The above will just remove commas.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

After you import the names you can run an Update query.
Here is the query SQL. Change the table and field names to whatever
yours are. Make a backup of the table first.

Update YourTable Set YourTable.[FieldName] =
Replace([FieldName],",","")

Smith, John will become Smith John.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -


Reply With Quote
  #4  
Old   
MGFoster
 
Posts: n/a

Default Re: Remove a comma programmatically - 04-24-2009 , 03:49 PM



musicloverlch wrote:
Quote:
I have 2 fields of names that can't have commas. Is there a way I can
programmatically "find and replace"?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

*************************** BACK UP BEFORE TRYING THIS **************

UPDATE table_name
SET column_name = REPLACE(column_name, ",","")
WHERE column_name LIKE "*,*"

If you're using ANSI-92 SQL mode change the LIKE to "%,%".

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSfIl7YechKqOuFEgEQKLtACgvVKZ0HPFDYh/LplupIFZ1TRjfxUAn1jw
G8RhUEvM7Mz02ajX4FA6oPFW
=IiEG
-----END PGP SIGNATURE-----


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.