Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Code Not Working (http://www.go4expert.com/forums/code-not-working-t21836/)

MARVELOUS MUGARI 18Apr2010 20:31

Code Not Working
 
can you pliz help me i have a code i want to use but i can't create a form from it


Code:

[ Dim r As New Recordset
Dim ct As Control
Dim cn As New Connection
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdstart_Click()
r.MoveFirst
Do While Not r.EOF
If UCase(Trim(TXTUN)) = UCase(Trim(r!Username)) And
Trim(TXTPASS) = Trim(r!Password) Then
i = 1
frmMain.Show
frmlogin.Hide
Exit Do
End If
r.MoveNext
Loop
If i = 0 Then
MsgBox "Invalid user."
TXTUser = ""
TXTPASS = ""
End If
End Sub
Private Sub Form_Activate()
TXTUN.Text = ""
TXTPASS.Text = ""
End Sub
Private Sub Form_Load()
Dim i As Integer
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
  .ConnectionString = "data source=" & App.Path &
"\library.mdb"
    .Open
    End With
  r.Open "select * from login", cn, adOpenDynamic,
adLockOptimistic
i = 0
End Sub]


MARVELOUS MUGARI 18Apr2010 20:39

Re: Message to all members
 
I'm a beginner in programming can you pliz help me create a form from this login form code
looking fowad to a helpfull reply on malvy01@hotmail.com
Code:


[Dim r As New Recordset
Dim ct As Control
Dim cn As New Connection
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdstart_Click()
r.MoveFirst
Do While Not r.EOF
If UCase(Trim(TXTUN)) = UCase(Trim(r!Username)) And
Trim(TXTPASS) = Trim(r!Password) Then
i = 1
frmMain.Show
frmlogin.Hide
Exit Do
End If
r.MoveNext
Loop
If i = 0 Then
MsgBox "Invalid user."
TXTUser = ""
TXTPASS = ""
End If
End Sub
Private Sub Form_Activate()
TXTUN.Text = ""
TXTPASS.Text = ""
End Sub
Private Sub Form_Load()
Dim i As Integer
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
  .ConnectionString = "data source=" & App.Path &
"\library.mdb"
    .Open
    End With
  r.Open "select * from login", cn, adOpenDynamic,
adLockOptimistic
i = 0
End Sub]


shabbir 19Apr2010 09:12

Re: Code Not Working
 
You have posted this under Introduction forum and I have moved it to VB forum

virxen 19Apr2010 18:12

Re: Code Not Working
 
1 Attachment(s)
here is your forms


change TXTUN --->TXTuser in your code
and put the code int the right place


All times are GMT +5.5. The time now is 16:57.