creatiing a login screen
-
Hi everyone... I'm new at working around vba and i'm trying to figure out a way to secure a mde file using a access form at the begining of the program. What it should do is check if the user has a registered key to access the main program file and allow him to work on the database. And if he doesn't have a registered key, get him to call the client to obtain one. So there's the the problem... i don't know where to start. Can anyone help me with this? Any example code is appreciated...:confused:
-
Hi everyone... I'm new at working around vba and i'm trying to figure out a way to secure a mde file using a access form at the begining of the program. What it should do is check if the user has a registered key to access the main program file and allow him to work on the database. And if he doesn't have a registered key, get him to call the client to obtain one. So there's the the problem... i don't know where to start. Can anyone help me with this? Any example code is appreciated...:confused:
Hopefully it helps :-D :-D Private Sub cmdOK_Click() 1 Dim CNN As New ADODB.Connection 2 Dim RCS As New ADODB.Recordset 3 Dim CNNstr As String 4 Dim sqlstr As String 5 Open App.Path + "\" + "db\CNNstr.txt" For Input As #1 6 Input #1, CNNstr 7 Close #1 8 CNN.CursorLocation = adUseClient 9 CNN.Open CNNstr 10 sqlstr = "select * from TABLE where UserID = '" & Text1.Text & "' and UserPassword ='" & Password & "'" 11 RCS.Open sqlstr, CNN, adOpenForwardOnly, adLockReadOnly 12 If RCS.RecordCount > 0 Then 13 Form1.Show 1 14 Else 15 r = MsgBox("Unauthorised User") 16 Text1.SetFocus 17 End If End Sub 1, 2, 3, 4 Declare variable 5 get the database path in text file 10 check whether the user exist and the password correct or not at once