I have no idea why I'm getting an error with the code below. It's basically an after update event on a combobox where I've incorporated the selected value into an sql string.
I'm getting the error :
'No value given for one or more required parameters'
Any clues as to what this could be? Thanks
Code:
Private Sub Combo2_AfterUpdate()
Dim rst As ADODB.Recordset
Dim str1 As String
Set rst = New ADODB.Recordset
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
box = Me.Combo2.Text
str1 = "SELECT Description FROM Table1 WHERE code = " & box
'error occurs on the line below?
rst.Open str1, CurrentProject.Connection, , , adcmttext
Me.Text0.Value = rst.Fields(0)