[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?
Re: VB6 Storing data from Access into a variable
Solved it:
variable = rs("Column_name").Value