X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Data Anonymous (scramble That Data) Iii, Any Version    
post Nov 17 2003, 10:23 AM

UdderAccess Admin + UA Ruler
Posts: 19,555
Joined: 27-April 02
From: Upper MI

I've seen a lot of folks here at UA post samples of their project in the forums and I've seen a lot of real data in those posts too, which is not recommended.
On order to make life a little easier, I created a text/memo field scrambler for data that already exists in a project that a member may want to post.
THere is a screenshot of the attached demo/app:
Attached File  datascrambler.gif ( 12.05K )Number of downloads: 13

The primary code looks like this:
Public Function myRandVal(nm As String)
' Randomizes Text Strings and/or numbers
' Usage: In a query - NameOfFieldRnd: myRandVal([NameOfField])
'        In a Form Control's "ControlSource" property - =myRandVal([NameOfField])
' Test in debug window - ?myRandVal("12345 UPPER & lower Case")
' Modified by Bob Raskew [URL="tel:11/1/2003"]11/1/2003[/URL] - Added number scrambling
Dim myChr As String
Dim myAsc As Integer
Dim I As Integer
    myRandVal = ""
    For I = 1 To Len(nm)
        myChr = Mid(nm, I, 1)
        If Asc(myChr) >= 65 And Asc(myChr) <= 90 Then
            myAsc = Int((90 - 65 + 1) * Rnd + 65)
          ElseIf Asc(myChr) >= 97 And Asc(myChr) <= 122 Then
            myAsc = Int((122 - 97 + 1) * Rnd + 97)
          ElseIf Asc(myChr) >= 48 And Asc(myChr) <= 57 Then
            myAsc = Int((57 - 48 + 1) * Rnd + 48)
            myAsc = Asc(myChr)
        End If
        myChr = Chr(myAsc)
        myRandVal = myRandVal & myChr
    Next I
End Function
There is a lot of other code in the demo. This was just a tickler.
To use it, just place the above code in a module and compile and save it. Then, use an Update Query to scramble the text and/or memo fields you want to scramble - myRandChr([NameOfField])
This is now set up for numbers, text and mixed text (numbers & text).
Before using it in a real project for placement as a post attachment here at UA, FIRST make a COPY of your db and apply the scramble to that db before posting it. That way, others can see your efforts and your project data remains anonymous.
The attached file contains Access 97, 2K3 and 2K7 versions of the demo.
Attached File  datascrambler.zip ( 218.28K )Number of downloads: 101

(Original # of downloads: 161 - updated on March 4, 2013 - added 2K3 & 2K7 versions)
hope this helps
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    25th February 2018 - 02:33 PM