with diffrent Privalliagle level show diffrent forms

sillyman
10-22-2004, 09:24 AM
I need help with the below code, basically I want it to show diffrent forms for diffrent priv values but it only works for priv value = to 1 not 0 it dosent do anything then!

rs.Open "Select * From Users Where [Username]= '" & txtUsername.Text & "' And [Password]= '" & txtPassword.Text & "'", cnn, adOpenForwardOnly, adLockReadOnly

With rs
If .Fields("Privalliages").Value = 1 Then
If Not (rs.EOF And rs.BOF) Then
MsgBox "Admin Mode"
Else
MsgBox "incorrect"
If .Fields("Privalliages").Value = 0 Then
If Not (rs.EOF And rs.BOF) Then
MsgBox "normal mode"
Else
MsgBox "incorrect"
End If

loquin
10-22-2004, 09:34 AM
I count 4 IFs but only 1 EndIF, so it's hard to decipher what your code is supposed to do.

Try this...

rs.Open "Select * From Users Where [Username]= '" & txtUsername.Text & "' And [Password]= '" & txtPassword.Text & "'", cnn, adOpenForwardOnly, adLockReadOnly

If rs.EOF and rs.BOF then
MsgBox "incorrect"
Else
If rs.Fields("Privalliages").Value = 1 then
gBox "Admin Mode"
Else
MsgBox "normal mode"
End If
End if

sillyman
10-22-2004, 09:36 AM
Thanxs loquin but I realised what I need to do. Basic If nesting!

With rs
If Not (rs.EOF And rs.BOF) Then
If .Fields("Privalliages").Value = 1 Then
MsgBox "hellow owrld"
Else
If .Fields("Privalliages").Value = 0 Then
MsgBox "hellow owrld"
Else
MsgBox "incorrect"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum