Results 1 to 2 of 2

Thread: [RESOLVED] VB6 Storing data from Access into a variable

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2013
    Posts
    7

    Resolved [RESOLVED] VB6 Storing data from Access into a variable

    My current code is as follows

    Code:
        Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
         
        Datalist.Clear
         
        Set cn = New ADODB.Connection
         
        cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                      "Data Source=C:\Users\User\Desktop\test\dbAdd.mdb;"
         
        Set rs = New ADODB.Recordset
         
        
        rs.Open "SELECT CertNo,IssueDate,Serial,RecalDue,CertNo_Vic,IssueDate_Vic,Serial_Vic,RecalDue_Vic FROM STICKER WHERE CertNo = '" & Data1 & "';", cn, adOpenStatic, adLockOptimistic
         
    
         
        Set rs = Nothing
        Set cn = Nothing
    I think I have correctly connected to the database how could I store each of the columns into a label?
    also is it possible to have instead of Data1 to have a selected listbox1 item to decide what row is pulled from the DB?

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2013
    Posts
    7

    Re: VB6 Storing data from Access into a variable

    Solved it:

    variable = rs("Column_name").Value

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