Hi guys I am making a dB for a local pc to store account info in, my usernames passwords pins etc, at the moment I use an encrypted word document but its not a very good way of storing this info, I was board so thought why not make a dB and see how much I remember from high school computing.
I followed this tutorial https://www.youtube.com/watch?v=356y...uJpHrcFj0vYZjW - how to make one
and could get it working, please note I have added two extra fields in the forum that also have to match with two feilds in the table so to log in you would need username pin A, pin B and the password. I did this just by using the same code as the password part, only I changed the buzz words, so that it checked each field correctly.
anyway I wanted to have an encrypted version partly so if the user table was ever open no one could see my passwords but also for something to do, so I watched this one https://www.youtube.com/watch?v=x4FA...uJpHrcFj0vYZjW - hashing passwords. However i get this error when I run the function https://gyazo.com/f3dc4b4e268761468819245f2c2d0af6 with the first encrypt highlighted.
I can't seem to work out what I have done wrong was hopping someone might be able to tell me, here is my code:
Global module code:
Code:
Option Compare Database
Option Explicit
Global g_Enabled As Boolean
Public Const Salt As Long = 69125478
Public Function Encrypt(strIn As String) As String
Dim strChr As String
Dim i As Integer
For i = 1 To Len(strIn)
strChr = strChr & CStr(Asc(Mid(strIn, i, 1)) Xor Salt)
Next i
Encrypt = strChr
End Function
run code:
Option Compare Database
Option Explicit
Private Sub Command19_Click()
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("accessaccountinfo", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "uname='" & Me.Text0 & "'"
If rs.NoMatch = True Then
Me.Label11.Visible = True
Me.Text0.SetFocus
Exit Sub
End If
Me.Label11.Visible = False
If rs!pinA <> Encrypt(Me.Text5, "") Then
Me.Label12.Visible = True
Me.Text5.SetFocus
Exit Sub
End If
Me.Label12.Visible = False
If rs!pinB <> Encrypt(Me.Text7, "") Then
Me.Label12.Visible = True
Me.Text5.SetFocus
Exit Sub
End If
Me.Label12.Visible = False
If rs!Password <> Encrypt(Me.Text9, "") Then
Me.Label12.Visible = True
Me.Text5.SetFocus
Exit Sub
End If
Me.Label12.Visible = False
If rs!status <> "active" Then
Me.Label22.Visible = True
Exit Sub
End If
DoCmd.OpenForm "renameme"
End Sub
Sorry I know that the field and text names are not helpful but I didn't have a reason to make them be as this is just for personal use.
tia
sam