1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Code Not Working

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

  1. MARVELOUS MUGARI

    MARVELOUS MUGARI New Member

    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

    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

    You have posted this under Introduction forum and I have moved it to VB forum
     
  4. virxen

    virxen New Member

    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:
      8

Share This Page