When i was entered into login page
the code is here

Private Sub txt_Password_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If UCase(txt_Password) = UCase(txt_dbPassword) Then
        Unload Me
       Modification_Main.Enabled = True
        'unlock database here
    Else
        MsgBox "Invalid password.", vbExclamation
        txt_Password.SetFocus
        SendKeys "{home}" & "+{end}"
        counter = counter + 1
        If counter = 3 Then
            MsgBox "You have reached the maximum tries to enter wrong password." & Chr(13) & _
                "System is terminating.", vbExclamation
            End
        End If
    End If
End If
If KeyAscii = 27 Then
    End
End If
End Sub

the error showing Compiler error,Cant find project or Library

Recommended Answers

All 9 Replies

on which line ?

this line indicating error

Private Sub txt_Password_KeyPress(KeyAscii As Integer)

In the IDE click on the Project menu item then select References. At the top will be the libraries that are selected for the project. The troublesome one should have "Missing" in the description.

please tell what is that application....i dont know which one is that

In the VB6 IDE (integrated development environment) the thing you develop your applications in.

please i dont know that the following code is error

Private Sub txt_Password_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If UCase(txt_Password) = UCase(txt_dbPassword) Then
        Unload Me
       Modification_Main.Enabled = True
        'unlock database here
    Else
        MsgBox "Invalid password.", vbExclamation
        txt_Password.SetFocus
        SendKeys "{home}" & "+{end}"
        counter = counter + 1
        If counter = 3 Then
            MsgBox "You have reached the maximum tries to enter wrong password." & Chr(13) & _
                "System is terminating.", vbExclamation
            End
        End If
    End If
End If
If KeyAscii = 27 Then
    End
End If
End Sub

that redline is error

why are you using Unload Me ?

why are you using keypress instead of keydown?

SO what is the error message.

it would be simpler to put a login button on the screen and put the code under that.

Also you need to ensure the variable counter is declared at the module level otherwise it will be reinitialised each keypress and be useless to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.