Solved

MS Access 2010 - replacing a character with zer0

Posted on 2012-04-04
4
258 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now