hello everyone,
i have been trying for days to get this to work. I keep getting syntax errors
I can't figure it out.
I want to use a variable that I have defined as stocksymbol in the where condition of the sql
the id is the key of the record
Dim stocksymbol as string
rst.Open "select * from stock where id = ", CurrentProject.Connection
I've tried everything .
Please help
Below is the code. This is so simple its driving me crazy
Private Sub Command22_Click()
Dim cnn1 As ADODB.Connection
Dim rst As ADODB.Recordset
dim stocksymbol as string
Set cnn1 = New ADODB.Connection
cnn1.Open CurrentProject.Connection
'
Set rst = New ADODB.Recordset 'assign the recordset
rst.LockType = adLockOptimistic
rst.Open "select * from stock where id = ", CurrentProject.Connection
rst.Close
Set rst = Nothing
cnn1.Close
End Sub
Thank you.