Advertisement
Guest User

ADO

a guest
Dec 20th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     'Move the ADO to the current member record
  2.    
  3.     Const PATH = "loginTest.mdb"
  4.  
  5.     Dim connectionAdo As New ADODB.Connection       'create new connection variable
  6.    Dim recordsetAdo As New ADODB.Recordset         'create new recordset variable
  7.    Dim found As Boolean
  8.     'Dim position As Integer
  9.    
  10.     'open connection to database
  11.    connectionAdo.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=SoftwareTrainingLad.mdb;Persist Security Info=False"
  12.  
  13.     'use SQL command to get details from user table
  14.    recordsetAdo.Open "SELECT * FROM user" & activity, connectionAdo, , adLockOptimistic
  15.  
  16.     'Initialise info from database
  17.  
  18.     recordsetAdo.MoveFirst
  19.    
  20.     Do Until recordsetAdo.EOF Or found     'repeat until record found or all file searched
  21.        'if ID matches current user ...
  22.        If recordsetAdo("username").Value = username Then
  23.             found = True                'set boolean flag to exit loop
  24.        Else
  25.             recordsetAdo.MoveNext          'next record
  26.        End If
  27.     Loop
  28.  
  29.      
  30.     If found = True Then
  31.         For position = 1 To 3
  32.             arrayDistance(position) = recordsetAdo.Fields(activity & "Dist" & position).Value
  33.             arrayBPM(position) = recordsetAdo.Fields(activity & "BPM" & position).Value
  34.         Next
  35.            
  36.         MsgBox ("Called")
  37.    
  38.     End If
  39.  
  40.  
  41.     connectionAdo.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement