Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 13th, 2006, 01:18 AM
Authorized User
Points: 172, Level: 3
Points: 172, Level: 3 Points: 172, Level: 3 Points: 172, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Singapore, , Singapore.
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.


Reply With Quote
  #2 (permalink)  
Old January 13th, 2006, 01:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
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

Reply With Quote
  #3 (permalink)  
Old January 13th, 2006, 08:51 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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
Reply With Quote
  #4 (permalink)  
Old January 16th, 2006, 05:23 AM
Authorized User
Points: 172, Level: 3
Points: 172, Level: 3 Points: 172, Level: 3 Points: 172, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Singapore, , Singapore.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I want to literally turn them into ***.

Regards

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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. amit_mande@yahoo.com 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



All times are GMT -4. The time now is 06:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.