help Retrieving data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweettama
    New Member
    • Oct 2008
    • 5

    help Retrieving data

    hi,
    im new joiner and i need help doing my project. im using visual basic and ms access.


    how can i retrive the data which i have added in database

    i add the data with this code
    [CODE=VB]
    Private Sub cmd_add_Click()
    Dim dbs As DAO.Database
    Dim rcd As DAO.Recordset
    If Me.txt_username = "" Then
    MsgBox "Enter Your Name Please", , "Your Name"
    Me.txt_username .SetFocus
    Exit Sub
    ElseIf Me.txt_password = "" Then
    MsgBox "Your Password ", , " Your Password"
    Me.txt_password .SetFocus
    Exit Sub
    Else
    Set dbs = OpenDatabase(Ap p.Path & "\Names.mdb ")
    Set rcd = dbs.OpenRecords et("userandpass word")
    With rcd
    .AddNew
    rcd!UserName = Me.txt_username
    rcd!Password = Me.txt_password
    .Update
    Me.txt_username .Text = ""
    Me.txt_password .Text = ""
    End With
    End If


    End Sub

    [/CODE]

    im hoping you can help me with this

    regards,
    Last edited by Dököll; Nov 17 '08, 03:10 AM. Reason: code tags...
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    are you trying to create new id in database and login with existing ids ?

    Comment

    • rpicilli
      New Member
      • Aug 2008
      • 77

      #3
      Hi there.

      I could realize that you create a data entry for your data base with 2 or 3 fields.

      UserName
      Password amd probably an Id for each register line of your database.

      To perform what I think you want you need to create a Query with Parameters.

      Something like "SELECT UserName, Password FROM YourDataBaseNam e
      WHERE UserName = txtName.text AND
      Password = txtPassword.tex t

      This Query will return to your program a Row of your database if is there one that has the information you supply in your Query.


      I hope this could help you

      Rpicilli

      Comment

      • sweettama
        New Member
        • Oct 2008
        • 5

        #4
        Thank you for your help :)

        Comment

        Working...