Results 1 to 4 of 4

Thread: Need help with transferring ADODB codes to module

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    20

    Need help with transferring ADODB codes to module

    Hi guys! So after a decade my boss wants me to create a simple visual basic program to track our document routing within the department. I'm having a hard time
    So i have these codes:

    Code:
    Dim oRS As ADODB.Recordset
       Dim sSQL As String
       Dim i As Integer
       Dim oConn As ADODB.Connection       
       Set oConn = New ADODB.Connection  
       oConn.Provider = "Microsoft.Jet.OLEDB.4.0"
       oConn.ConnectionString = "Data Source=" & App.Path & "\tracking.mdb"
       oConn.Open     
       sSQL = "SELECT username, password, fname FROM users WHERE username = '" & txtusername.Text & "'"
       Set oRS = New Recordset
       'Open our recordset
       oRS.Open sSQL, oConn
       
       If oRS.EOF Then
           MsgBox "Invalid Username!", vbInformation, "Try Again"
       Else
           If oRS.Fields.Item("password") <> txtpassword.Text Then
               MsgBox "Invalid Password!", vbInformation, "Try Again"
               txtpassword.SetFocus
           Else
               LoginSucceeded = True
               logged_user = oRS.Fields("fname").Value
               Me.Hide
           End If
       End If  
       oRS.Close
       oConn.Close
    this works fine but everytime i create another form like add new user, i have to copy everything. Can someone tell me which codes should i transfer to "new module"? and which codes should i call in every form i make? Thanks
    Last edited by cherrydee; Oct 18th, 2016 at 01:17 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width