Hi i'm doing a project and i need help.

I'm designing a system, whereby am unable to use 2 different login authorities, which are Admin and Non-Admin. I am using VB.NET and Ms. Access and need help for the codes.

I want something like, if i click on admin/non admin (with different passwords) a dialog box pops onto the screen and asks for the password. If the password is correct it should take me to the form i want. Something of this sort please.

Help me with the codes n explanation thanks, ASAP

Recommended Answers

All 9 Replies

Hi,

I never used something like that, but I'll try to give you an idee how I would do it.

I should say that the login form is a normal Login form with admin and Non- Admin usernames and passwords.
The logic will be in the Ms- Access database itself.

For example, if there's a Non- Admin login then the database will be Read- Only or allowed to do some changes in that database, for Admin logins then you have full autority to do some changes in that database.

Just a thought.

Ok, thnks...Well am basically just asking whether is it possible to code both admin and non-admin with different passwords and is it possible

Hey i got the solution to this, but i used kind of a tricky style, thnks for your help :P, But if anyone gets better solutions to this lemme know

How did you do it Jolly, Im now who you were before you got the codes..
Bring me out ..I cant even deduce how to link the admin form with database forms..

fourty

How did you do it Jolly, Im now who you were before you got the codes..
Bring me out ..I cant even deduce how to link the admin form with database forms..

fourty

Hi i basically used the vb 6 format... that is add a textbox on ur form and then add a button, double click the button and write the codes as follows:

dim password as string
password=textbox1.text

if textbox1= "jolly" then
form2.show
else
Messagebox.show ("Invalid password")
end if

In this case the password is jolly. U can drag a label and write username into it then place the textbox besides it. Hope this helps you if u encounter any error let me know, so i could help you. You can use this process without connecting to a database or with (/both)

CORRECTION USE THE FOLLOWING NOT THE ABOVE:


Pass1 = txt1.Text

If Pass1 = "jolly" Then

MessageBox.Show("WELCOME")

Form1.Show()

Me.Hide()

Else

txt1.Clear()

MessageBox.Show("INVALID PASSWORD, TRY AGAIN")

txt1.Focus()

End If

Pass1 = txt1.Text

If Pass1 = "jolly" Then

MessageBox.Show("WELCOME")

Form1.Show()

Me.Hide()

Else

txt1.Clear()

MessageBox.Show("INVALID PASSWORD, TRY AGAIN")

txt1.Focus()

End If

maybe this help you

imports system.data.oledb //this can be used in ms access


private sub BtnLogin_Click() <- Your BtnLogin

dim con as new oledbconnection("your connection string here")
dim cmd as OledbCommand = new OledbCommand("Select * from YourDataTable where Username = '" & txtUsername.text &"' and Password = '" & txtPassword.text & "',con)

dim sdr as OledbDataReader = cmd.ExecuteReader() 'the sdr will read your command and search for it in the database or in your ms access file

if Combobox.text = "Admin" then 'you must use a combobox with items "Admin" and "Non-Admin"

if sdr.Read() = true then
msgbox("Login Successfully")
else
msgbox("Login Failed")
end if

elseif Combobox.text = "non-admin" then

if sdr.Read() = true then
msgbox("Login Successfully")
else
msgbox("Login Failed")
end if

else
//put your codes here
end if

End Sub

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.