Solved

MS Access 2010 - replacing a character with zer0

Posted on 2012-04-04
4
261 Views
Last Modified: 2012-04-04
I need to replace all fields in a table that contain a "-" with a "0",  in vba code.  I know it can be done in a query.
0
Comment
Question by:Startrac98
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37806881
Create your query, and then run it in VBA.  For what you are describing, it would look something like this:


dim strSQL as String
strSQL = "UPDATE YourTable SET YourField = Replace(YourField, '-','0')"
CurrentDB.Execute strSQL, dbfailonerror
0
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 37806904
I like mbizup's solution.
0
 

Author Comment

by:Startrac98
ID: 37807112
Perfect, Thanks
0
 

Author Closing Comment

by:Startrac98
ID: 37807119
Yes, that works.  Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question