Key requires to Opeing a Access file

Reshmi mohankumar

Registered User.
Local time
Tomorrow, 04:15
Joined
Dec 5, 2017
Messages
101
I Want to run my access file with reading the key in notepad file(notepad file path will route by me). if notepad file doesn't find then quit the application..will any suggest the way to solve this on opening form on load event??
 
Please tell us WHAT the issue/intent is. I think you have described how you have done something tht doesn't quite work and you are asking for assistance. We need to know what before we can suggest how.

Are you wanting a User to submit a Password and have it verified before using the database?
 
Please tell us WHAT the issue/intent is. I think you have described how you have done something tht doesn't quite work and you are asking for assistance. We need to know what before we can suggest how.

Are you wanting a User to submit a Password and have it verified before using the database?

User verification is within the database is depends on the users table, but i need system verification to opening database should be verified by a notepad file.
 
How can u know which txt file to open and verify. Tell more.
 
How can u know which txt file to open and verify. Tell more.


Can't we use database table value comparison with that text file ?
If where the value of the database data and text file data will match then access file should run, else quit the application with message.
 
Here's an approach to show concept:
Code:
Option Compare Database
Option Explicit

Private Sub Form_Load()

          Dim myWord As String
10        Dim keywordForLoad As String: keywordForLoad = "RESHMI"
20        Open "C:\users\jack\documents\special.txt" For Input As #1
30        On Error GoTo Form_Load_Error
40        Line Input #1, myWord
50        Debug.Print myWord

60        If myWord <> keywordForLoad Then
70            MsgBox "Invalid keyword --Exiting" & vbCrLf _
                  & "Application.Quit ---would stop Access"
80            Me.Label1.Visible = False
              ' Application.quit
90        Else
100           Debug.Print "MyWord:" & myWord & "  keywordforload: " & keywordForLoad
110           Me.Label1.Visible = True
120       End If
130       Close #1
140       On Error GoTo 0
150       Exit Sub

Form_Load_Error:

160       MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Load, line " & Erl & "."

End Sub

Uses a txt file called special.txt and a single record with the "keyword".
your load event need to have a "value" to compare with the "keyword"
if the words match, load the form and open the database
if the words don't match--error and Quit.

I recommend you watch this video by Steve Bishop
 
reshmi, if you are in a domain environment, you might do better to just have a list of accepted users (like a User table) and then use the Environ("Username") function to see who is attempting to come in. Then you don't have to worry about a password because the user had to supply one to enter the domain. Further, if you have the ability to do it, make your list of accepted users members of a domain-based group and then set permissions on the database folder and files to MODIFY for members of that group. Then all you have to do is add a user to a group and add that user's login name to your user table.

If you are not in a domain environment, this obviously will not work. But you have to realize that the inherent security of granting access via a notepad file (or any other kind of file) is questionable at best, since you are in essence "kicking the can down the road." If you have a password in a file, you need to protect that file from people who should not have that password. So how were you going to do that? Put another password on the password file? But then would you want to get THAT password from a file? Do you see the potentially infinite regression?
 
If you have the password in the table you can use Dcount() or Dlookup() to verify if the txt in the file match of that in the table.
 

Users who are viewing this thread

Back
Top Bottom