If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Help create a login form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-11, 07:41
smkso smkso is offline
Registered User
 
Join Date: Sep 2011
Posts: 5
Red face Help create a login form

Hello,

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!
Reply With Quote
  #2 (permalink)  
Old 09-27-11, 08:05
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
Quote:
I got messed up with DLookUp function and I really,really,really need somebody's help!
..so what did you try?
...what went wrong?
....what is the problem you are trying to resolve?
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 09-27-11, 09:12
smkso smkso is offline
Registered User
 
Join Date: Sep 2011
Posts: 5
my code

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

Here's how the data looks like;

Table: Students
Columns:
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"
Me.cboIC.SetFocus
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"

Else
MsgBox "IC does not exists. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.cboIC.SetFocus
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!"
Application.Quit
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!
Reply With Quote
Reply

Tags
access, dlookup, login, vba

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On