Hi. I'm trying to write the sql results to a textbox for display. My codes are as follows to retrieve the value via sql. However, i'm having trouble writing the results to the textbox. Can anyone help?
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
With cn
.Provider = "Microsoft.jet.oledb.4.0"
.CursorLocation = adUseClient
.ConnectionString = App.Path + "\Quotation.mdb"
.Open
End With
rs.Open "select [productcode] from products where ([productname]='" & Label14.Caption & "'),cn,adopenkeyset"
rs.Close
End Sub
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
With cn
.Provider = "Microsoft.jet.oledb.4.0"
.CursorLocation = adUseClient
.ConnectionString = App.Path + "\Quotation.mdb"
.Open
End With
rs.Open "select [productcode] from products where ([productname]='" & Label14.Caption & "'),cn,adopenkeyset"
rs.Close
End Sub