none
Run Time error 94 RRS feed

  • Question

  •    pass = DLookup("[Password]", "tblUser", "[Password] = '" & Me.txtPasssword.Value & "'")

    I face problem on this code. The pass variable is String type.

    Saturday, November 11, 2017 1:19 PM

All replies

  • Declare pass as a Variant instead of as a String. You can then use code like

        If IsNull(pass) Then
            MsgBox "Password incorrect"
        Else
            MsgBox "Password correct"
        End If


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Saturday, November 11, 2017 1:45 PM
  • i did it. then they show another problem.

    run time error 2467

    on same code

    Saturday, November 11, 2017 2:14 PM
  • don't use the .value

    & Me.txtPasssword.Value &

    & Me.txtPasssword &

    Saturday, November 11, 2017 2:27 PM
  • done. but also show me same problem. my fuul code in below

    Private Sub Command1_Click()
        Dim UserLevel As Variant
        Dim Pass As Variant
    If IsNull(Me.txtLoginID) Then
        MsgBox "Please Enter Login ID.", vbInformation, "Login ID Required"
        Me.txtLoginID.SetFocus
        
    ElseIf IsNull(Me.txtPasssword) Then
        MsgBox "Please Enter Password.", vbInformation, "Password Required"
        Me.txtPasssword.SetFocus
        

    Else
     'process the job
     
        If (IsNull(DLookup("[UserLogin]", "tblUser", "[Userlogin] ='" & Me.txtLoginID.Value & "'"))) And (IsNull(DLookup("[Password]", "tblUser", "[Password] = '" & Me.txtPasssword.Value & "'"))) Then
            MsgBox "Incorrect Login ID or Password"
        Else
            DoCmd.Close
            Pass = DLookup("[Password]", "tblUser", "[Password] = '" & Me.txtPasssword & "'")
            UserLevel = DLookup("[UserLogin]", "tblUser", "[Userlogin] ='" & Me.txtLoginID & "'")
            If UserLevel = "admin" And Pass = "admin" Then
                DoCmd.OpenForm "MainForm"
            ElseIf UserLevel = "bangla" And Pass = "banglasub" Then
                DoCmd.OpenForm "Bangla Form"
            ElseIf UserLevel = "english" And Pass = "englishsub" Then
                DoCmd.OpenForm "Eng Form"
            ElseIf UserLevel = "ict" And Pass = "ictsub" Then
                DoCmd.OpenForm "ICT Form"
            ElseIf UserLevel = "physics" And Pass = "physicssub" Then
                DoCmd.OpenForm "Phy Form"
            ElseIf UserLevel = "math" And Pass = "mathsub" Then
                DoCmd.OpenForm "Math Form"
            ElseIf UserLevel = "biology" And Pass = "biologysub" Then
                DoCmd.OpenForm "Bio Form"
            ElseIf UserLevel = "chemistry" And Pass = "chemistrysub" Then
                DoCmd.OpenForm "Che Form"
            ElseIf UserLevel = "economic" And Pass = "economicsub" Then
                DoCmd.OpenForm "Economic Form"
            ElseIf UserLevel = "management" And Pass = "managementsub" Then
                DoCmd.OpenForm "Eco Form"
            ElseIf UserLevel = "accounting" And Pass = "accountingsub" Then
                DoCmd.OpenForm "Acc Form"
            ElseIf UserLevel = "finance11" And Pass = "financesub" Then
                DoCmd.OpenForm "Fin Form"
            End If

        End If
        
    End If
        
        
    End Sub

    Saturday, November 11, 2017 2:32 PM
  • Hi Jahida,

    I try to reproduce the issue on my side.

    I used the code below.

    Private Sub Command2_Click()
    Dim pass As Variant
    pass = DLookup("[activity_by]", "demo_data", "[node] = '" & Me.Text0 & "'")
    MsgBox (pass)
    End Sub
    

    Output:

    now, you will get a run time error 94 when you pass the value in textbox which is not available in table.

    so you need to make sure that value is available in table which you are entering in the Textbox.

    the reason for error 2467 is that you place the docmd.close at incorrect place.

    try to change the position of docmd.close to solve the error.

    Reference:

     Run-time error 2467 - object that is closed - Any Ideas?    

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 13, 2017 2:05 AM
    Moderator
  • Hi Jahida,

    is your issue solved?

    I find that you did not done any follow up after my last post.

    if your issue is solved then try to post the solution and mark it as an answer.

    if your issue is still exist then try to refer the suggestion given by the community members.

    if then also you have any further questions then let us know about that.

    we will try to provide you further suggestions to solve your issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 17, 2017 5:33 AM
    Moderator