Hituptony
Hituptony

Reputation: 2860

SSRS Encryption with VBA

So I have an SSRS report with a field called member_ID. When a user clicks on the member_ID I need it to hyperlink to an external website.

Due to the nature of the member_ID I need this to be encrypted.

In order to get it to go to an external site. I'm using the Action-> Go To URL Property.

However, I'm confused on how the encryption will take place at this level...I also identified a section in the report properties called Code where you can write custom code. But I'm not too familiar with VBA. Any idea on how to accomplish this?

I've googled VBA code that does the AES encryption but where do I apply it? What if there's an existing function there?

Upvotes: 0

Views: 206

Answers (1)

Hannover Fist
Hannover Fist

Reputation: 10880

You can have multiple functions in the CODE section. Each will start with FUNCTION FunctionName (ByVal InputVariable as VarType) as VarType and end with END FUNCTION to separate them. If your code takes an ID and encrypts it, there should be one InputVariable that would be your member_ID.

Example Function:

Private bOddRow(10) As Boolean 

Function AlternateColor(ByVal OddColor As String, ByVal EvenColor As String, ByVal Toggle As Boolean, ByVal Type AS INTEGER) As String 
  If Toggle Then bOddRow(Type) = Not bOddRow(Type) 
  If bOddRow(Type) Then 
                Return OddColor 
  Else 
               Return EvenColor 
  End If 
End Function

This function is used by using Code.FunctionName with the InputVariables in parenthesis -

=CODE.AlternateColor("White", "AliceBlue", 0, 0)

If your function name is AESEncrpyt, you would use something like:

="http://www.yoururl.com/something.asp?Member=" & CODE.AESEncrpyt(Fields!MemberID.Value)

for your link Action.

Upvotes: 1

Related Questions