Code Not Working

Discussion in 'Visual Basic ( VB )' started by MARVELOUS MUGARI, Apr 18, 2010.

  1. MARVELOUS MUGARI

    MARVELOUS MUGARI New Member

    Joined:
    Apr 18, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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]
     
    Last edited by a moderator: Apr 19, 2010
  2. MARVELOUS MUGARI

    MARVELOUS MUGARI New Member

    Joined:
    Apr 18, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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]
     
    Last edited by a moderator: Apr 19, 2010
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You have posted this under Introduction forum and I have moved it to VB forum
     
  4. virxen

    virxen Active Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    28
    here is your forms


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

    Attached Files:

    • g4.rar
      File size:
      1.4 KB
      Views:
      412

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice