Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2006, 01:18 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with update query in Access

Hi,

I need help with update query function. I have a table with a field, "user_no", containing information which I need to manipulate. The info contains 5 characters, beginning with G. The last 3 characters are numbers which I wish to update to "***". As for the second character, it ranges from A-Z and I do not wish to make any changes to it.

For eg.
I have the following:

GA111
GS123
GK234

How do I fill in the "Update To" field in order to change the information to:

GA***
GS***
GK***

Pls help.

Thanks.


 
Old January 13th, 2006, 01:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hello,

Paste the following function in a standard module:

Code:
Public Function f_ModifyData(strInput As String) As String
   Dim strCharacters As String
   Dim strOutput As String

   strCharacters = Left$(strInput, 2)
   strOutput = strCharacters & "***"

   f_ModifyData = strOutput
End Function
Paste the following SQL statement in your query designer in SQL View:

Code:
UPDATE tblData SET tblData.DataItem = f_ModifyData(DataItem);
Or in query design view:

Field: DataItem
Table: tblData
UpdateTo: f_ModifyData(DataItem)

HTH,

Bob

Field

 
Old January 13th, 2006, 08:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Just a clarification, Sunny. Do you actually want to turn the numbers LITERALLY into asterisks, e.g. 123 to ***, or do you really want to MASK the numbers so that they remain 123 underneath but only APPEAR *** to the eye?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old January 16th, 2006, 05:23 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I want to literally turn them into ***.

Regards






Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Query Help dalezjc Classic ASP Basics 8 March 18th, 2008 08:49 AM
Update Query Neal SQL Server 2000 2 April 19th, 2007 12:03 PM
I solved insert query.now see this Update Query. [email protected] VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Update query cilla Classic ASP Databases 11 November 9th, 2004 08:12 AM
Update query edcaru Access 3 June 14th, 2004 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.