Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011

    Red face Unanswered: Help create a login form


    I need some help to create a login form. First of all, I have a table with Student Idetification Card (IC) and some other columns.

    In this case, I just want to create a simple login form, whereby a student just enter their IC No. and if their IC No. exists in the data, he can login and automatically go to his profile, which is a form that is already filled up with his/her data which he/she can edit.

    There is two main events here;
    1. The student enter their ID.
    2. After granted, system will bring them to a form with their personal data already filled up.

    I got messed up with DLookUp function and I really,really,really need somebody's help!

    A big thanks in advance!

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I got messed up with DLookUp function and I really,really,really need somebody's help! what did you try?
    ...what went wrong?
    ....what is the problem you are trying to resolve?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2011

    my code

    Thanks healdem for your concern! I hope you can help me through!

    Here's how the data looks like;

    Table: Students
    1. Student's IC (Primary Key)
    2. Name
    3. Address
    4. Phone Number

    I've created a login form which has a text box (cboIC) and a login button.

    I want the student to enter their Identification No and the system will find if the ID exists in the data or not.

    My code for the form is;

    Private Sub cmdLogin_Click()

    'Check to see if data is entered into the Student IC combo box

    If IsNull(Me.cboIC) Or Me.cboIC = "" Then
    MsgBox "You must enter your IC.", vbOKOnly, "Required Data"
    Exit Sub
    End If

    'Check value of ID in Students to see if it exists

    If Me.cboIC.Value = DLookup("[Student IC]", "[Students]", "[Students IC]=" & Me.cboIC.Value) Then

    Students IC = Me.cboIC.Value

    'Close logon form and open splash screen

    DoCmd.Close acForm, "Login", acSaveNo
    DoCmd.OpenForm "MainForm"

    MsgBox "IC does not exists. Please Try Again", vbOKOnly, "Invalid Entry!"
    End If

    'If Student Enters incorrect IC 3 times database will shutdown

    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
    MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
    End If

    End Sub

    Private Sub Login_Click()

    End Sub


    Ok, the problem is, it always shows an error, and it is related to the dlookup line function.

    Will someone help me!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts